package www.openteam.com.ui.realtime;


import android.app.DatePickerDialog;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatSpinner;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import www.openteam.com.R;
import www.openteam.com.api.HttpManager;
import www.openteam.com.base.mBaseFragment;
import www.openteam.com.bean.BaseWeight;
import www.openteam.com.bean.DocPrice;
import www.openteam.com.bean.ExchangeRate;
import www.openteam.com.bean.FOBItem2;
import www.openteam.com.bean.FOBPrice;
import www.openteam.com.bean.Mopocedure;
import www.openteam.com.bean.PaperDGsm;
import www.openteam.com.bean.PaperItemGrpName;
import www.openteam.com.bean.PaperTypeName;
import www.openteam.com.bean.PrintMesg;
import www.openteam.com.bean.ProcessDonePduReust;
import www.openteam.com.bean.ProcessDoneType;
import www.openteam.com.contract.PrintContract;
import www.openteam.com.presenter.PrintPresenter;
import www.openteam.com.tool.ToastUtil;

/**
 * A simple {@link Fragment} subclass.
 */
public class PrintFragment extends mBaseFragment<PrintPresenter> implements PrintContract.PrintView {


    private static final int EDIT_OK = 1;
    @Bind(R.id.NBag_custom)
    Button NBagCustom;
    @Bind(R.id.Bag_SpCustom)
    Spinner BagSpCustom;
    @Bind(R.id.NBag_date)
    TextView NBagDate;
    @Bind(R.id.Bag_date)
    TextView BagDate;
    @Bind(R.id.NPintType)
    TextView NPintType;
    @Bind(R.id.SpPintType)
    EditText SpPintType;
    @Bind(R.id.Naddress)
    TextView Naddress;
    @Bind(R.id.Spaddress)
    Spinner Spaddress;
    @Bind(R.id.NInkType)
    TextView NInkType;
    @Bind(R.id.SpInkType)
    Spinner SpInkType;
    @Bind(R.id.NFOBType)
    TextView NFOBType;
    @Bind(R.id.SpFOBType)
    Spinner SpFOBType;
    @Bind(R.id.NPurchaseNum)
    TextView NPurchaseNum;
    @Bind(R.id.EdPurchaseNum)
    AppCompatEditText EdPurchaseNum;
    @Bind(R.id.NAssessor)
    TextView NAssessor;
    @Bind(R.id.EdAssessor)
    AppCompatEditText EdAssessor;
    @Bind(R.id.length)
    AppCompatEditText length;
    @Bind(R.id.wide)
    AppCompatEditText wide;
    @Bind(R.id.high)
    AppCompatEditText high;
    @Bind(R.id.print_note)
    EditText printNote;
    @Bind(R.id.item_1)
    Spinner item1;
    @Bind(R.id.groupName_1)
    AppCompatEditText groupName1;
    @Bind(R.id.tpsNumb_1)
    AppCompatEditText tpsNumb1;
    @Bind(R.id.tpsUnit_1)
    Spinner tpsUnit1;
    @Bind(R.id.tpslength_1)
    AppCompatEditText tpslength1;
    @Bind(R.id.tpswidth_1)
    AppCompatEditText tpswidth1;
    @Bind(R.id.LayoutNumb_1)
    TextView LayoutNumb1;
    @Bind(R.id.LayoutLength_1)
    AppCompatEditText LayoutLength1;
    @Bind(R.id.LayoutWidth_1)
    AppCompatEditText LayoutWidth1;
    @Bind(R.id.LayoutUps_1)
    AppCompatEditText LayoutUps1;
    @Bind(R.id.Paper_Length_1)
    AppCompatEditText PaperLength1;
    @Bind(R.id.PaperWidth_1)
    AppCompatEditText PaperWidth1;
    @Bind(R.id.PaperGsm_1)
    TextView PaperGsm1;
    @Bind(R.id.PaperTypeNumb_1)
    AppCompatEditText PaperTypeNumb1;
    @Bind(R.id.PaperTypeName_1)
    Spinner PaperTypeName1;
    @Bind(R.id.PaperDgsm_1)
    TextView PaperDgsm1;
    @Bind(R.id.PaperDReam_1)
    TextView PaperDReam1;
    @Bind(R.id.PaperSet_1)
    TextView PaperSet1;
    @Bind(R.id.Leaf_1)
    AppCompatEditText Leaf1;
    @Bind(R.id.WastFPPlate_1)
    TextView WastFPPlate1;
    @Bind(R.id.TotalReam_1)
    TextView TotalReam1;
    @Bind(R.id.mmCopy_1)
    TextView mmCopy1;
    @Bind(R.id.kgCopy1)
    TextView kgCopy1;
    @Bind(R.id.totalWegt1)
    TextView totalWegt1;
    @Bind(R.id.TotalCost1)
    TextView TotalCost1;
    @Bind(R.id.parent)
    GridLayout paperParent;
    @Bind(R.id.paperCost_add)
    ImageButton paperCostAdd;
    @Bind(R.id.print_item_1)
    TextView printItem1;
    @Bind(R.id.print_groupName_1)
    TextView printGroupName1;
    @Bind(R.id.print_cmkyfontNumb_1)
    AppCompatEditText printCmkyfontNumb1;
    @Bind(R.id.print_cmkybackNumb_1)
    AppCompatEditText printCmkybackNumb1;
    @Bind(R.id.print_pmsfontNumb_1)
    AppCompatEditText printPmsfontNumb1;
    @Bind(R.id.print_pmsbackNumb_1)
    AppCompatEditText printPmsbackNumb1;
    @Bind(R.id.print_MVfontNumb_1)
    AppCompatEditText printMVfontNumb1;
    @Bind(R.id.print_MVfontType_1)
    Spinner printMVfontType1;
    @Bind(R.id.print_MVbackNumb_1)
    AppCompatEditText printMVbackNumb1;
    @Bind(R.id.print_MVbackType_1)
    Spinner printMVbackType1;
    @Bind(R.id.print_SDfontNumb_1)
    AppCompatEditText printSDfontNumb1;
    @Bind(R.id.print_SDfontType_1)
    Spinner printSDfontType1;
    @Bind(R.id.print_SDbackNumb_1)
    AppCompatEditText printSDbackNumb1;
    @Bind(R.id.print_SDbackType_1)
    Spinner printSDbackType1;
    @Bind(R.id.print_turnType_1)
    Spinner printTurnType1;
    @Bind(R.id.print_PaperBoard_1)
    TextView printPaperBoard1;
    @Bind(R.id.print_sheet_1)
    TextView printSheet1;
    @Bind(R.id.print_rate_1)
    AppCompatEditText printRate1;
    @Bind(R.id.print_mincost_1)
    EditText printMincost1;
    @Bind(R.id.print_totalcost_1)
    TextView printTotalcost1;
    @Bind(R.id.print_unitcost_1)
    TextView printUnitcost1;
    @Bind(R.id.print_remain_1)
    AppCompatEditText printRemain1;
    @Bind(R.id.print_parent)
    GridLayout printParent;
    @Bind(R.id.process_parent)
    GridLayout processParent;
    @Bind(R.id.processDone_parent)
    GridLayout processDoneParent;
    @Bind(R.id.processSecondDone_parent)
    GridLayout poceDSendParent;
    @Bind(R.id.bookBinding_parent)
    GridLayout bkbParent;
    @Bind(R.id.AROIC_parent)
    GridLayout AOOICParent;
    @Bind(R.id.FOBCost_parent)
    GridLayout FOBCostParent;
    @Bind(R.id.GIFCost_parent)
    GridLayout GIFCostParent;
    @Bind(R.id.DOCFOBCost_parent)
    GridLayout DOCFOBCostParent;
    @Bind(R.id.TotalCostOrRate_parent)
    GridLayout TotalCostOrRateParent;
    @Bind(R.id.TitleNumb)
    EditText titleNumb;
    @Bind(R.id.NTitleNumb)
    TextView NTitleNumb;
    @Bind(R.id.process_item)
    TextView processItem;
    @Bind(R.id.process_groupName)
    TextView processGroupName;
    @Bind(R.id.process_KindsType)
    AppCompatSpinner processKindsType;
    @Bind(R.id.process_Kinds)
    TextView processKinds;
    @Bind(R.id.process_A)
    TextView processA;
    @Bind(R.id.process_B)
    TextView processB;
    @Bind(R.id.process_Dplate)
    TextView processDplate;
    @Bind(R.id.process_PlateSet)
    TextView processPlateSet;
    @Bind(R.id.process_PlateQty)
    TextView processPlateQty;
    @Bind(R.id.process_MinCost)
    AppCompatEditText processMinCost;
    @Bind(R.id.process_ExtraPCXT)
    AppCompatEditText processExtraPCXT;
    @Bind(R.id.process_UnitCost)
    TextView processUnitCost;
    @Bind(R.id.process_TotalCost)
    TextView processTotalCost;
    @Bind(R.id.processDone_item)
    Spinner processDoneItem;
    @Bind(R.id.processDone_groupname)
    TextView processDoneGroupname;
    @Bind(R.id.processDone_type)
    Spinner processDoneType;
    @Bind(R.id.processDone_produceRequest)
    Spinner processDoneProduceRequest;
    @Bind(R.id.processDone_side)
    AppCompatEditText processDoneSide;
    @Bind(R.id.processDone_Dsheet)
    TextView processDoneDsheet;
    @Bind(R.id.processDone_minSheet)
    TextView processDoneMinSheet;
    @Bind(R.id.processDone_price)
    TextView processDonePrice;
    @Bind(R.id.processDone_totalQty)
    TextView processDoneTotalQty;
    @Bind(R.id.processDone_minCost)
    AppCompatEditText processDoneMinCost;
    @Bind(R.id.processDone_TotalCost)
    TextView processDoneTotalCost;
    @Bind(R.id.processDone_unitCost)
    TextView processDoneUnitCost;
    @Bind(R.id.processDone_remake)
    AppCompatEditText processDoneRemake;
    @Bind(R.id.processDone_typeCode)
    TextView processDoneTypeCode;
    @Bind(R.id.poceDSecnd_Item)
    Spinner poceDSecndItem;
    @Bind(R.id.poceDSecnd_GroupName)
    TextView poceDSecndGroupName;
    @Bind(R.id.poceDSecnd_Type)
    Spinner poceDSecndType;
    @Bind(R.id.poceDSecnd_PdceRest)
    Spinner poceDSecndPdceRest;
    @Bind(R.id.poceDSecnd_UpSheet)
    AppCompatEditText poceDSecndUpSheet;
    @Bind(R.id.poceDSecnd_Length)
    AppCompatEditText poceDSecndLength;
    @Bind(R.id.poceDSecnd_Width)
    AppCompatEditText poceDSecndWidth;
    @Bind(R.id.poceDSecnd_DSQ)
    AppCompatEditText poceDSecndDSQ;
    @Bind(R.id.poceDSecnd_Times)
    AppCompatEditText poceDSecndTimes;
    @Bind(R.id.poceDSecnd_LabourCost)
    TextView poceDSecndLabourCost;
    @Bind(R.id.poceDSecnd_DSheet)
    TextView poceDSecndDSheet;
    @Bind(R.id.poceDSecnd_Pcs)
    AppCompatEditText poceDSecndPcs;
    @Bind(R.id.poceDSecnd_Mould)
    TextView poceDSecndMould;
    @Bind(R.id.poceDSecnd_TotalQty)
    TextView poceDSecndTotalQty;
    @Bind(R.id.poceDSecnd_MinCost)
    TextView poceDSecndMinCost;
    @Bind(R.id.poceDSecnd_TotalCost)
    TextView poceDSecndTotalCost;
    @Bind(R.id.poceDSecnd_UnitCost)
    TextView poceDSecndUnitCost;
    @Bind(R.id.poceDSecnd_Remake)
    AppCompatEditText poceDSecndRemake;
    @Bind(R.id.poceDSecnd_TypeCode)
    TextView poceDSecndTypeCode;
    @Bind(R.id.BKB_Item)
    Spinner BKBItem;
    @Bind(R.id.BKB_PodueRest)
    Spinner BKBPodueRest;
    @Bind(R.id.BKB_Numb)
    AppCompatEditText BKBNumb;
    @Bind(R.id.BKB_Unit)
    Spinner BKBUnit;
    @Bind(R.id.BKB_HourPrice)
    TextView BKBHourPrice;
    @Bind(R.id.BKB_HandSeconds)
    TextView BKBHandSeconds;
    @Bind(R.id.BKB_HandCFCient)
    TextView BKBHandCFCient;
    @Bind(R.id.BKB_MinPrice)
    TextView BKBMinPrice;
    @Bind(R.id.BKB_MinCost)
    TextView BKBMinCost;
    @Bind(R.id.BKB_TotalCost)
    TextView BKBTotalCost;
    @Bind(R.id.BKB_UnitCost)
    TextView BKBUnitCost;
    @Bind(R.id.BKB_Remake)
    AppCompatEditText BKBRemake;
    @Bind(R.id.BKB_TypeCode)
    TextView BKBTypeCode;
    @Bind(R.id.AOOIC_Item)
    AppCompatEditText AOOICItem;
    @Bind(R.id.AOOIC_Specical)
    AppCompatEditText AOOICSpecical;
    @Bind(R.id.AOOIC_Price)
    AppCompatEditText AOOICPrice;
    @Bind(R.id.AOOIC_QtyPcs)
    AppCompatEditText AOOICQtyPcs;
    @Bind(R.id.AOOIC_Wastage)
    AppCompatEditText AOOICWastage;
    @Bind(R.id.AOOIC_Mincost)
    AppCompatEditText AOOICMincost;
    @Bind(R.id.AOOIC_MMCopy)
    AppCompatEditText AOOICMMCopy;
    @Bind(R.id.AOOIC_KGCopy)
    AppCompatEditText AOOICKGCopy;
    @Bind(R.id.AOOIC_TotalCost)
    TextView AOOICTotalCost;
    @Bind(R.id.AOOIC_UnitCost)
    TextView AOOICUnitCost;
    @Bind(R.id.AOOIC_Remake)
    AppCompatEditText AOOICRemake;
    @Bind(R.id.FOB_item1_1)
    TextView FOBItem11;
    @Bind(R.id.FOB_item2_1)
    TextView FOBItem21;
    @Bind(R.id.FOB_price_1)
    TextView FOBPrice1;
    @Bind(R.id.FOB_TotalQty_1)
    AppCompatEditText FOBTotalQty1;
    @Bind(R.id.FOB_MinCost_1)
    AppCompatEditText FOBMinCost1;
    @Bind(R.id.FOB_TotalCost_1)
    TextView FOBTotalCost1;
    @Bind(R.id.FOB_UnitCost_1)
    TextView FOBUnitCost1;
    @Bind(R.id.FOB_Remake_1)
    AppCompatEditText FOBRemake1;
    @Bind(R.id.FOB_item1_3)
    TextView FOBItem13;
    @Bind(R.id.FOB_item2_3)
    TextView FOBItem23;
    @Bind(R.id.FOB_price_3)
    TextView FOBPrice3;
    @Bind(R.id.FOB_TotalQty_3)
    AppCompatEditText FOBTotalQty3;
    @Bind(R.id.FOB_MinCost_3)
    AppCompatEditText FOBMinCost3;
    @Bind(R.id.FOB_TotalCost_3)
    TextView FOBTotalCost3;
    @Bind(R.id.FOB_UnitCost_3)
    TextView FOBUnitCost3;
    @Bind(R.id.FOB_Remake_3)
    AppCompatEditText FOBRemake3;
    @Bind(R.id.FOB_item1_4)
    TextView FOBItem14;
    @Bind(R.id.FOB_item2_4)
    TextView FOBItem24;
    @Bind(R.id.FOB_price_4)
    TextView FOBPrice4;
    @Bind(R.id.FOB_TotalQty_4)
    AppCompatEditText FOBTotalQty4;
    @Bind(R.id.FOB_MinCost_4)
    AppCompatEditText FOBMinCost4;
    @Bind(R.id.FOB_TotalCost_4)
    TextView FOBTotalCost4;
    @Bind(R.id.FOB_UnitCost_4)
    TextView FOBUnitCost4;
    @Bind(R.id.FOB_Remake_4)
    AppCompatEditText FOBRemake4;
    @Bind(R.id.FOB_item1_5)
    TextView FOBItem15;
    @Bind(R.id.FOB_item2_5)
    TextView FOBItem25;
    @Bind(R.id.FOB_price_5)
    TextView FOBPrice5;
    @Bind(R.id.FOB_TotalQty_5)
    AppCompatEditText FOBTotalQty5;
    @Bind(R.id.FOB_MinCost_5)
    AppCompatEditText FOBMinCost5;
    @Bind(R.id.FOB_TotalCost_5)
    TextView FOBTotalCost5;
    @Bind(R.id.FOB_UnitCost_5)
    TextView FOBUnitCost5;
    @Bind(R.id.FOB_Remake_5)
    AppCompatEditText FOBRemake5;
    @Bind(R.id.FOB_item1_6)
    TextView FOBItem16;
    @Bind(R.id.FOB_item2_6)
    TextView FOBItem26;
    @Bind(R.id.FOB_price_6)
    TextView FOBPrice6;
    @Bind(R.id.FOB_TotalQty_6)
    AppCompatEditText FOBTotalQty6;
    @Bind(R.id.FOB_MinCost_6)
    AppCompatEditText FOBMinCost6;
    @Bind(R.id.FOB_TotalCost_6)
    TextView FOBTotalCost6;
    @Bind(R.id.FOB_UnitCost_6)
    TextView FOBUnitCost6;
    @Bind(R.id.FOB_Remake_6)
    AppCompatEditText FOBRemake6;
    @Bind(R.id.FOB_item1_7)
    TextView FOBItem17;
    @Bind(R.id.FOB_item2_7)
    TextView FOBItem27;
    @Bind(R.id.FOB_price_7)
    TextView FOBPrice7;
    @Bind(R.id.FOB_TotalQty_7)
    AppCompatEditText FOBTotalQty7;
    @Bind(R.id.FOB_MinCost_7)
    AppCompatEditText FOBMinCost7;
    @Bind(R.id.FOB_TotalCost_7)
    TextView FOBTotalCost7;
    @Bind(R.id.FOB_UnitCost_7)
    TextView FOBUnitCost7;
    @Bind(R.id.FOB_Remake_7)
    AppCompatEditText FOBRemake7;
    @Bind(R.id.FOB_item1_8)
    TextView FOBItem18;
    @Bind(R.id.FOB_item2_8)
    TextView FOBItem28;
    @Bind(R.id.FOB_price_8)
    TextView FOBPrice8;
    @Bind(R.id.FOB_TotalQty_8)
    AppCompatEditText FOBTotalQty8;
    @Bind(R.id.FOB_MinCost_8)
    AppCompatEditText FOBMinCost8;
    @Bind(R.id.FOB_TotalCost_8)
    TextView FOBTotalCost8;
    @Bind(R.id.FOB_UnitCost_8)
    TextView FOBUnitCost8;
    @Bind(R.id.FOB_Remake_8)
    AppCompatEditText FOBRemake8;
    @Bind(R.id.FOB_item1_9)
    TextView FOBItem19;
    @Bind(R.id.FOB_item2_9)
    TextView FOBItem29;
    @Bind(R.id.FOB_price_9)
    TextView FOBPrice9;
    @Bind(R.id.FOB_TotalQty_9)
    AppCompatEditText FOBTotalQty9;
    @Bind(R.id.FOB_MinCost_9)
    AppCompatEditText FOBMinCost9;
    @Bind(R.id.FOB_TotalCost_9)
    TextView FOBTotalCost9;
    @Bind(R.id.FOB_UnitCost_9)
    TextView FOBUnitCost9;
    @Bind(R.id.FOB_Remake_9)
    AppCompatEditText FOBRemake9;
    @Bind(R.id.GIF_Item)
    TextView GIFItem;
    @Bind(R.id.GIF_Price)
    AppCompatEditText GIFPrice;
    @Bind(R.id.GIF_TotalQty)
    AppCompatEditText GIFTotalQty;
    @Bind(R.id.GIF_MinCost)
    AppCompatEditText GIFMinCost;
    @Bind(R.id.GIF_Toalcost)
    TextView GIFToalcost;
    @Bind(R.id.GIF_UnitCost)
    TextView GIFUnitCost;
    @Bind(R.id.GIF_Remake)
    AppCompatEditText GIFRemake;
    @Bind(R.id.GIF_Item1)
    TextView GIFItem1;
    @Bind(R.id.GIF_Price1)
    AppCompatEditText GIFPrice1;
    @Bind(R.id.GIF_TotalQty1)
    AppCompatEditText GIFTotalQty1;
    @Bind(R.id.GIF_MinCost1)
    AppCompatEditText GIFMinCost1;
    @Bind(R.id.GIF_Toalcost1)
    TextView GIFToalcost1;
    @Bind(R.id.GIF_UnitCost1)
    TextView GIFUnitCost1;
    @Bind(R.id.GIF_Remake1)
    AppCompatEditText GIFRemake1;
    @Bind(R.id.GIF_Item2)
    TextView GIFItem2;
    @Bind(R.id.GIF_Price2)
    AppCompatEditText GIFPrice2;
    @Bind(R.id.GIF_TotalQty2)
    AppCompatEditText GIFTotalQty2;
    @Bind(R.id.GIF_MinCost2)
    AppCompatEditText GIFMinCost2;
    @Bind(R.id.GIF_Toalcost2)
    TextView GIFToalcost2;
    @Bind(R.id.GIF_UnitCost2)
    TextView GIFUnitCost2;
    @Bind(R.id.GIF_Remake2)
    AppCompatEditText GIFRemake2;
    @Bind(R.id.DOC_Item)
    TextView DOCItem;
    @Bind(R.id.DOC_Price)
    TextView DOCPrice;
    @Bind(R.id.DOC_TotalQty)
    AppCompatEditText DOCTotalQty;
    @Bind(R.id.DOC_MinCost)
    AppCompatEditText DOCMinCost;
    @Bind(R.id.DOC_TotalCost)
    TextView DOCTotalCost;
    @Bind(R.id.DOC_UnitCost)
    TextView DOCUnitCost;
    @Bind(R.id.DOC_Remake)
    AppCompatEditText DOCRemake;
    @Bind(R.id.DOC_Item1)
    TextView DOCItem1;
    @Bind(R.id.DOC_Price1)
    TextView DOCPrice1;
    @Bind(R.id.DOC_TotalQty1)
    AppCompatEditText DOCTotalQty1;
    @Bind(R.id.DOC_MinCost1)
    AppCompatEditText DOCMinCost1;
    @Bind(R.id.DOC_TotalCost1)
    TextView DOCTotalCost1;
    @Bind(R.id.DOC_UnitCost1)
    TextView DOCUnitCost1;
    @Bind(R.id.DOC_Remake1)
    AppCompatEditText DOCRemake1;
    @Bind(R.id.DOC_Item2)
    TextView DOCItem2;
    @Bind(R.id.DOC_Price2)
    TextView DOCPrice2;
    @Bind(R.id.DOC_TotalQty2)
    AppCompatEditText DOCTotalQty2;
    @Bind(R.id.DOC_MinCost2)
    AppCompatEditText DOCMinCost2;
    @Bind(R.id.DOC_TotalCost2)
    TextView DOCTotalCost2;
    @Bind(R.id.DOC_UnitCost2)
    TextView DOCUnitCost2;
    @Bind(R.id.DOC_Remake2)
    AppCompatEditText DOCRemake2;
    @Bind(R.id.DOC_Item3)
    TextView DOCItem3;
    @Bind(R.id.DOC_Price3)
    TextView DOCPrice3;
    @Bind(R.id.DOC_TotalQty3)
    AppCompatEditText DOCTotalQty3;
    @Bind(R.id.DOC_MinCost3)
    TextView DOCMinCost3;
    @Bind(R.id.DOC_TotalCost3)
    TextView DOCTotalCost3;
    @Bind(R.id.DOC_UnitCost3)
    TextView DOCUnitCost3;
    @Bind(R.id.DOC_Remake3)
    AppCompatEditText DOCRemake3;
    @Bind(R.id.NUSDRate)
    TextView NUSDRate;
    @Bind(R.id.USDRate)
    AppCompatEditText USDRate;
    @Bind(R.id.NMakeUpRate)
    TextView NMakeUpRate;
    @Bind(R.id.MakeUpRate)
    AppCompatEditText MakeUpRate;
    @Bind(R.id.Total_HKD)
    TextView TotalHKD;
    @Bind(R.id.Total_USD)
    TextView TotalUSD;
    @Bind(R.id.HKD)
    TextView HKD;
    @Bind(R.id.USD)
    TextView USD;
    @Bind(R.id.RMB_Include)
    TextView RMBInclude;
    @Bind(R.id.PaperCostRate)
    TextView PaperCostRate;
    @Bind(R.id.printCostRate)
    TextView printCostRate;
    @Bind(R.id.progressCstRate)
    TextView progressCstRate;
    @Bind(R.id.finishCostRate)
    TextView finishCostRate;
    @Bind(R.id.ScndPoceCstRate)
    TextView ScndPoceCstRate;
    @Bind(R.id.BindCstRate)
    TextView BindCstRate;
    @Bind(R.id.AcesCstRate)
    TextView AcesCstRate;
    @Bind(R.id.PackCstRate)
    TextView PackCstRate;
    @Bind(R.id.fobCstRate)
    TextView fobCstRate;
    @Bind(R.id.gifCstRate)
    TextView gifCstRate;
    @Bind(R.id.docCstRate)
    TextView docCstRate;
    @Bind(R.id.TotalCstRate)
    TextView TotalCstRate;
    @Bind(R.id.WstgCstRate)
    TextView WstgCstRate;
    @Bind(R.id.NKG)
    TextView NKG;
    @Bind(R.id.PKG)
    TextView PKG;
    @Bind(R.id.PCBM)
    TextView PCBM;
    @Bind(R.id.CBM)
    TextView CBM;
    @Bind(R.id.PaperMoneyType_1)
    Spinner PaperMoneyType1;
    @Bind(R.id.PaperMoneyRate_1)
    TextView PaperMoneyRate1;
    @Bind(R.id.print_rateA_1)
    TextView printRateA1;
    @Bind(R.id.print_mincostA_1)
    TextView printMincostA1;
    private String TAG = this.getClass().getSimpleName();
    int[][] ids = new int[11][28];
    int[][] print_ids = new int[11][24];
    int[][] process_ids = new int[11][13];
    int[][] processDone_ids = new int[11][14];
    int[][] poceDSecnd_ids = new int[11][20];
    int[][] bkb_ids = new int[11][13];
    int[][] aooic_ids = new int[11][11];
    int[][] fob_ids = new int[8][8];
    int[][] gif_ids = new int[3][7];
    int[][] doc_ids = new int[4][7];
    int i = 2;
    private ArrayAdapter<String> paperItemTypeAdapter;
    private ArrayAdapter<String> paperTPS_UnitAdapter;
    private ArrayAdapter<String> paperClassNameAdapter;
    private ArrayAdapter<String> paperTypeNameAdapter;
    private ArrayAdapter<String> printMVFontTypeAdapter;
    private ArrayAdapter<String> printTurnTypeAdapter;
    OnEditTextCallBack onEditTextCallBack;
    private String S9;
    private ArrayAdapter<String> processKindsTypeAdapter;
    private ArrayAdapter<String> poceDonePduReustAdapter;
    private List<ProcessDonePduReust.DataBeanX.DataBean> poceDPdunRest;
    private ArrayAdapter<String> poceDoneTypeAdapter;
    private ArrayAdapter<String> moneyTypeAdapter;
    private double purChaseNumb;
    private double titleN;
    private List<ProcessDoneType.DataBeanX.DataBean> poceDoneTypeData;
    private ArrayList<PaperItemGrpName> itemGrpNameList;
    private ArrayAdapter<String> poceDoneItemAdapter;
    private ArrayList<String> poceDoneitemList;
    private int k = 0;
    private String selectedItem;
    private ArrayAdapter<String> bkbUnitAdapter;
    private ArrayList<Object> fobItem1List;
    private ArrayList<Double> paperTotalCostList;
    private ArrayList<Double> printingTotalCostList;
    private ArrayList<Double> progressTotalCostList;
    private ArrayList<Double> finishTotalCostList;
    private ArrayList<Double> poceDSecndTotalCostList;
    private ArrayList<Double> bindingTotalCostList;
    private ArrayList<Double> acesoTotalCostList;
    private ArrayList<Double> fobTotalCostList;
    private ArrayList<Double> gifTotalCostList;
    private ArrayList<Double> docTotalCostList;
    private ArrayList<Double> kgCopyList;
    private ArrayList<Double> totalWeightList;
    private List<ExchangeRate.DataBeanX.DataBean> exchangeRateData;
    private double baseWeight1;
    private Mopocedure.DataBeanX.DataBean mopocedureN;

    public PrintFragment() {
        // Required empty public constructor
    }

    interface OnEditTextCallBack {
        void setOnBack(String str);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for getContext() fragment
        View view = inflater.inflate(R.layout.fragment_print, container, false);
        ButterKnife.bind(this, view);
        initIds();
        initPrintIds();
        initProgressIds();
        initProcessDoneIds();
        initPoceDSecndIds();
        initBKBIds();
        initAOOIcIds();
        initFOBIds();
        initGIFIds();
        initDOCIds();
        mPresenter = loadPresenter();
        initData();
        initView();
        initListener();
        return view;
    }


    @Override
    protected void initData() {
        if (mPresenter != null)
            mPresenter.attachView(this);
        purChaseNumb = Double.valueOf(TextUtils.isEmpty(EdPurchaseNum.getText().toString()) ? "0" : EdPurchaseNum.getText().toString());
        titleN = Double.valueOf(TextUtils.isEmpty(titleNumb.getText().toString()) ? "0" : titleNumb.getText().toString());
        itemGrpNameList = new ArrayList<>();
        poceDoneitemList = new ArrayList<>();
        fobItem1List = new ArrayList<>();
        paperTotalCostList = new ArrayList<>();
        printingTotalCostList = new ArrayList<>();
        progressTotalCostList = new ArrayList<>();
        finishTotalCostList = new ArrayList<>();
        poceDSecndTotalCostList = new ArrayList<>();
        bindingTotalCostList = new ArrayList<>();
        acesoTotalCostList = new ArrayList<>();
        fobTotalCostList = new ArrayList<>();
        gifTotalCostList = new ArrayList<>();
        docTotalCostList = new ArrayList<>();
        ArrayList<String> inkTypeList = new ArrayList<>();
        inkTypeList.add("soy ink");
        inkTypeList.add("normal ink");
        ArrayAdapter<String> inkTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, inkTypeList);
        inkTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        SpInkType.setAdapter(inkTypeAdapter);
        ArrayList<String> fobTypeList = new ArrayList<>();
        fobTypeList.add("FOB HK");
        fobTypeList.add("FOB YT");
        fobTypeList.add("HK Local");
        fobTypeList.add("Nil.");
        ArrayAdapter<String> fobTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, fobTypeList);
        fobTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        SpFOBType.setAdapter(fobTypeAdapter);
        fobItem1List = new ArrayList<>();
        fobItem1List.add("無");
        fobItem1List.add("計25CBM ,18T  20塊卡板");
        fobItem1List.add("計53CBM ,20T  42塊卡板");
        fobItem1List.add("(打卡板,走散貨,CFS費用)");
        fobItem1List.add("(無打卡板,走散貨,CFS費用)");
        fobItem1List.add("FOB 散貨運輸費1");
        fobItem1List.add("FOB 散貨運輸費2");
        fobItem1List.add("FOB 散貨運輸費3");


        ArrayList<String> addressTypeList = new ArrayList<>();
        addressTypeList.add("交香港寫字樓");
        addressTypeList.add("交香港倉");
        ArrayAdapter<String> addressTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, addressTypeList);
        addressTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        Spaddress.setAdapter(addressTypeAdapter);

        ArrayList<String> printItemTypeList = new ArrayList<>();
        printItemTypeList.add("Box");
        printItemTypeList.add("Cards");
        printItemTypeList.add("Cover");
        printItemTypeList.add("Divider");
        printItemTypeList.add("Ends");
        printItemTypeList.add("Envolope");
        printItemTypeList.add("Fluter");
        printItemTypeList.add("G/B");
        printItemTypeList.add("Jacket");
        printItemTypeList.add("Leaf");
        printItemTypeList.add("Let");
        printItemTypeList.add("Liner");
        printItemTypeList.add("PLC");
        printItemTypeList.add("Slipcase");
        printItemTypeList.add("Warp");
        printItemTypeList.add("text1");
        printItemTypeList.add("text2");
        printItemTypeList.add("text3");
        paperItemTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, printItemTypeList);
        paperItemTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        item1.setAdapter(paperItemTypeAdapter);
        ArrayList<String> printTPS_UnitTypeList = new ArrayList<>();
        printTPS_UnitTypeList.add("PP");
        printTPS_UnitTypeList.add("pcs");
        printTPS_UnitTypeList.add("SP");
        paperTPS_UnitAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, printTPS_UnitTypeList);
        paperTPS_UnitAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        tpsUnit1.setAdapter(paperTPS_UnitAdapter);
//        ArrayList<String> printClassNameList = new ArrayList<>();
//        printClassNameList.add("紙張");
//        printClassNameList.add("坑紙-PVC");
//        printClassNameList.add("坑紙-APET");
//        printClassNameList.add("坑紙-進口");
//        printClassNameList.add("坑紙-其它");
//        printClassNameList.add("膠片-PVC");
//        printClassNameList.add("膠片-APET");
//        printClassNameList.add("膠片-進口");
//        printClassNameList.add("膠片-其它");
//        paperClassNameAdapter = new ArrayAdapter<String>(getContext(),
//                android.R.layout.simple_spinner_dropdown_item, printClassNameList);
//        paperClassNameAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//        PaperTypeName1.setAdapter(paperClassNameAdapter);

        ArrayList<String> printMVFontTypeList = new ArrayList<>();
        printMVFontTypeList.add("print");
        printMVFontTypeList.add("solid");
        printMVFontTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, printMVFontTypeList);
        printMVFontTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        printMVfontType1.setAdapter(printMVFontTypeAdapter);
        printMVbackType1.setAdapter(printMVFontTypeAdapter);
        printSDfontType1.setAdapter(printMVFontTypeAdapter);
        printSDbackType1.setAdapter(printMVFontTypeAdapter);

        ArrayList<String> printTurnTypeList = new ArrayList<>();
        printTurnTypeList.add("trun");
        printTurnTypeList.add("");
        printTurnTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, printTurnTypeList);
        printTurnTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        printTurnType1.setAdapter(printTurnTypeAdapter);

        ArrayList<String> processKindsTypeList = new ArrayList<>();
        processKindsTypeList.add("CTP");
        processKindsTypeList.add("film to plate");
        processKindsTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, processKindsTypeList);
        processKindsTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        processKindsType.setAdapter(processKindsTypeAdapter);

        ArrayList<String> bkbUnitList = new ArrayList<>();
        bkbUnitList.add("pcs");
        bkbUnitList.add("sintimes");
        bkbUnitAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, bkbUnitList);
        bkbUnitAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        BKBUnit.setAdapter(bkbUnitAdapter);
    }

    @Override
    protected void initListener() {

//        Naddress.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                int a = 0;
//                for (int j = 121; j < 201; j++) {
//                    a = a+j;
//                }
//                SpPintType.setText(a+"");
//            }
//        });

        NBagCustom.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.getPrintMesg();
                mPresenter.getPaperTypeName();
                mPresenter.getProcessDonePruRest();
                mPresenter.getProcessDoneType();
                mPresenter.getExchangeRate();
            }
        });
        BagDate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BagDate.setTag(BagDate);
                selectCalendar(BagDate);
            }
        });

        tpsNumb1.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                int str = Integer.valueOf(s.toString()) * Integer.valueOf(
                        TextUtils.isEmpty(titleNumb.getText()) ? "0" : titleNumb.getText().toString());
                LayoutNumb1.setText(str + "");
            }
        });

//        selectedItem = PaperTypeName1.getSelectedItem().toString();


        final double AC9 = Double.valueOf(TextUtils.isEmpty(TotalReam1.getText()) ? "1" : TotalReam1.getText().toString());
        final double W9 = Double.valueOf(TextUtils.isEmpty(PaperDReam1.getText()) ? "0" : PaperDReam1.getText().toString());
        final double P9 = Double.valueOf(TextUtils.isEmpty(PaperGsm1.getText()) ? "0" : PaperGsm1.getText().toString());
        final double R9 = Double.valueOf(TextUtils.isEmpty(PaperTypeNumb1.getText().toString()) ? "0" : PaperTypeNumb1.getText().toString());
        final double J9 = Double.valueOf(TextUtils.isEmpty(LayoutLength1.getText()) ? "0" : LayoutLength1.getText().toString());
        final double L9 = Double.valueOf(TextUtils.isEmpty(LayoutWidth1.getText()) ? "0" : LayoutWidth1.getText().toString());
        final double U9 = Double.valueOf(TextUtils.isEmpty(PaperDgsm1.getText()) ? "0" : PaperDgsm1.getText().toString());
        final double N9 = Double.valueOf(TextUtils.isEmpty(LayoutUps1.getText()) ? "1" : LayoutUps1.getText().toString());
        final double I9 = Double.valueOf(TextUtils.isEmpty(LayoutNumb1.getText()) ? "0" : LayoutNumb1.getText().toString());
        final double AG9 = Double.valueOf(TextUtils.isEmpty(PaperSet1.getText()) ? "1" : PaperSet1.getText().toString());
        final double Y9 = Double.valueOf(TextUtils.isEmpty(WastFPPlate1.getText()) ? "0" : WastFPPlate1.getText().toString());

        final double C9 = Double.valueOf(TextUtils.isEmpty(tpsNumb1.getText().toString()) ? "0" : tpsNumb1.getText().toString());
        final double AN9 = Double.valueOf(TextUtils.isEmpty(Leaf1.getText()) ? "0" : Leaf1.getText().toString());
        final double E9 = Double.valueOf(TextUtils.isEmpty(tpslength1.getText()) ? "0" : tpslength1.getText().toString());
        final double G9 = Double.valueOf(TextUtils.isEmpty(tpswidth1.getText()) ? "0" : tpswidth1.getText().toString());
        final double AO9 = Double.valueOf(TextUtils.isEmpty(Leaf1.getText()) ? "1" : Leaf1.getText().toString());
        final String B26 = printItem1.getText().toString();
        final String D24 = SpInkType.getSelectedItem().toString();
        final double C26 = Double.valueOf(TextUtils.isEmpty(printCmkyfontNumb1.getText()) ? "0" : printCmkyfontNumb1.getText().toString());
        final double D26 = Double.valueOf(TextUtils.isEmpty(printCmkybackNumb1.getText()) ? "0" : printCmkybackNumb1.getText().toString());
        final double E26 = Double.valueOf(TextUtils.isEmpty(printPmsfontNumb1.getText()) ? "0" : printPmsfontNumb1.getText().toString());
        final double F26 = Double.valueOf(TextUtils.isEmpty(printPmsbackNumb1.getText()) ? "0" : printPmsbackNumb1.getText().toString());
        final double G26 = Double.valueOf(TextUtils.isEmpty(printMVfontNumb1.getText()) ? "0" : printMVfontNumb1.getText().toString());
        final double J26 = Double.valueOf(TextUtils.isEmpty(printMVbackNumb1.getText()) ? "0" : printMVbackNumb1.getText().toString());
        final double M26 = Double.valueOf(TextUtils.isEmpty(printSDfontNumb1.getText()) ? "0" : printSDfontNumb1.getText().toString());
        final double R26 = Double.valueOf(TextUtils.isEmpty(printSDbackNumb1.getText()) ? "0" : printSDbackNumb1.getText().toString());
        final double Y26 = Double.valueOf(TextUtils.isEmpty(printSheet1.getText()) ? "0" : printSheet1.getText().toString());
        final double Z26 = Double.valueOf(TextUtils.isEmpty(printRate1.getText()) ? "0" : printRate1.getText().toString());
        final double W26 = Double.valueOf(TextUtils.isEmpty(printPaperBoard1.getText()) ? "0" : printPaperBoard1.getText().toString());
        final double AG26 = Double.valueOf(TextUtils.isEmpty(printMincost1.getText()) ? "0" : printMincost1.getText().toString());
        final double AT26 = Double.valueOf(TextUtils.isEmpty(printTotalcost1.getText()) ? "0" : printTotalcost1.getText().toString());

        final String U26 = printTurnType1.getSelectedItem().toString();
        final String B43 = processItem.getText().toString();
        final double M43 = Double.valueOf(TextUtils.isEmpty(processA.getText()) ? "0" : processA.getText().toString());
        final double N43 = Double.valueOf(TextUtils.isEmpty(processB.getText()) ? "0" : processB.getText().toString());
        final double S43 = Double.valueOf(TextUtils.isEmpty(processPlateSet.getText()) ? "0" : processPlateSet.getText().toString());
        final double U43 = Double.valueOf(TextUtils.isEmpty(processPlateQty.getText()) ? "0" : processPlateQty.getText().toString());
        final double P43 = Double.valueOf(TextUtils.isEmpty(processDplate.getText()) ? "0" : processDplate.getText().toString());
        final double AC43 = Double.valueOf(TextUtils.isEmpty(processTotalCost.getText()) ? "0" : processTotalCost.getText().toString());
        final double Y43 = Double.valueOf(TextUtils.isEmpty(processExtraPCXT.getText()) ? "0" : processExtraPCXT.getText().toString());
        final String G43 = processKindsType.getSelectedItem().toString();
        final String K43 = processKinds.getText().toString();
        final String H26 = printMVfontType1.getSelectedItem().toString();
        final String O26 = printSDfontType1.getSelectedItem().toString();
        final String K26 = printMVbackType1.getSelectedItem().toString();
        final String S26 = printSDbackType1.getSelectedItem().toString();
        final double C5 = Double.valueOf(TextUtils.isEmpty(titleNumb.getText()) ? "0" : titleNumb.getText().toString());
        final double V5 = Double.valueOf(TextUtils.isEmpty(EdPurchaseNum.getText().toString()) ? "0" : EdPurchaseNum.getText().toString());

        setPaperClick(J9, L9, P9, U9, R9, N9, I9, AG9, Y9, C9, AN9, E9, G9, AO9, AC9, W9);


        printPaperBoard1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (!B26.isEmpty()) {
                    if (D24.contains("soy ink")) {
                        if (P9 > 157) {
                            str = 1.44444444444;
                        } else if (P9 <= 157) {
                            str = 1.71428571428;
                        }
                    }
                    if (D24.contains("normal ink")) {
                        if (P9 > 157) {
                            str = 1;
                        } else if (P9 <= 157) {
                            str = 1;
                        }
                    }
                    printPaperBoard1.setText(str + "");
                }
            }
        });


        printSheet1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (AG9 > 0) {
                    str = AC9 * 500 / AG9;
                }
                printSheet1.setText(str + "");
            }
        });
        printRateA1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                mopocedureN = null;
                double conditon1 = doubleValue(printCmkybackNumb1) + doubleValue(printCmkyfontNumb1) +
                        doubleValue(printPmsbackNumb1) + doubleValue(printPmsfontNumb1) +
                        doubleValue(printSDbackNumb1) + doubleValue(printSDfontNumb1) +
                        doubleValue(printMVbackNumb1) + doubleValue(printMVfontNumb1);
                double paperlength = doubleValue(LayoutLength1);
                double paperWidth = doubleValue(LayoutWidth1);
                double paperGsm = doubleValue(PaperGsm1);
                if (conditon1 > 0) {
                    if (paperlength > 29.25 && paperWidth > 29.25 || paperlength > 41.7 || paperWidth > 41.7) {
                        findMopocedure();
                        if (null != mopocedureN) {
                            str = doubleValue(mopocedureN.getFullprintrate(), "100");
                        }
                    } else if (paperGsm > 157) {
                        str = doubleValue(mopocedureN.getCrossfoldprintrate1(), "40");
                    } else if (paperGsm <= 157) {
                        str = doubleValue(mopocedureN.getCrossfoldprintrate2(), "50");
                    }
                }
                printRateA1.setText(str + "");
            }
        });


        printMincostA1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = doubleValue(printRateA1.getText().toString()) * 3 *
                        (doubleValue(printCmkybackNumb1) + doubleValue(printCmkyfontNumb1) +
                                doubleValue(printPmsbackNumb1) * 1.5 + doubleValue(printPmsfontNumb1) * 1.5 +
                                doubleValue(printMVbackNumb1) * 2 + doubleValue(printMVfontNumb1) * 2 +
                                doubleValue(printSDbackNumb1) * 3 + doubleValue(printSDfontNumb1) * 3) *
                        doubleValue(PaperSet1) * doubleValue(printPaperBoard1);
                printMincostA1.setText(str + "");
            }
        });


        printTotalcost1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb > 0) {
                    double a = 0;
                    if (C26 < 1) {
                        a = C26 * 1;
                    } else {
                        a = C26;
                    }
                    if (D26 < 1) {
                        a = a + D26 * 1;
                    } else {
                        a = a + D26;
                    }
                    a = a + (G26 + J26) * 2 + (E26 + F26) * 1.5 + (M26 + R26) * 3;
                    a = a * Y26 * Z26 * AG9 / 1000 * W26;
                    if (a > AG26) {
                        str = a;
                    } else {
                        str = AG26;
                    }
                }
                printTotalcost1.setText(str + "");
            }
        });

        printUnitcost1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb > 0) {
                    str = AT26 / purChaseNumb;
                }
                printUnitcost1.setText(str + "");
            }
        });

        processKinds.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String str = "";
                if (J9 > 29.25 && L9 > 29.25) {
                    str = "L";
                } else if (J9 > 41.7 || L9 > 41.7) {
                    str = "L";
                } else {
                    str = "S";
                }
                processKinds.setText(str);
            }
        });

        processA.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = C26 + E26;
                if (H26.contains("print")) {
                    str = str + G26;
                }
                if (O26.contains("print")) {
                    str = str + M26;
                }
                processA.setText(str + "");
            }
        });

        processB.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = D26 + F26;
                if (K26.contains("print")) {
                    str += J26;
                }
                if (S26.contains("print")) {
                    str += R26;
                }
                processB.setText(str + "");
            }
        });

        processDplate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                double str = 0;
                if (!B43.isEmpty()) {
                    if (G43.contains("CTP")) {
                        if (K43.contains("S")) {
                            str = 100;
                        } else {
                            str = 150;
                        }
                    } else {
                        if (K43.contains("S")) {
                            str = 60;
                        } else {
                            str = 120;
                        }
                    }
                }
                processDplate.setText(str + "");
            }
        });

        processPlateSet.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                processPlateSet.setText(AG9 + "");
            }
        });

        processPlateQty.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (U26.contains("turn")) {
                    str = (M43 + N43) / 2 * S43;
                } else {
                    str = (M43 + N43) * S43;
                }
                processPlateQty.setText(str + "");
            }
        });

        processUnitCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (C5 > 0 && V5 > 0) {
                    str = AC43 / C5 / V5;
                }
                processUnitCost.setText(str + "");
            }
        });

        processTotalCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (V5 > 0) {
                    str = U43 * P43;
                }
                str = str * Y43;
                processTotalCost.setText(str + "");
            }
        });

        processDoneItem.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                processDoneGroupname.setText(itemGrpNameList.get(position).getGroupName());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        processDoneProduceRequest.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                processDoneDsheet.setText(dataBean.getPrice());
                processDoneMinSheet.setText(dataBean.getMinprice());
                processMinCost.setText(dataBean.getMincost());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        processDoneType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String code = poceDoneTypeData.get(position).getCode();
                processDoneTypeCode.setText(code);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        final double Minsheet = Double.valueOf(TextUtils.isEmpty(processDoneMinSheet.getText()) ? "0" : processDoneMinSheet.getText().toString());
        final String B77 = processGroupName.getText().toString();
        final String B9 = item1.getSelectedItem().toString();
        final double Y77 = Double.valueOf(TextUtils.isEmpty(processDoneTotalQty.getText()) ? "0" : processDoneTotalQty.getText().toString());
        final double V77 = Double.valueOf(TextUtils.isEmpty(processDoneDsheet.getText()) ? "0" : processDoneDsheet.getText().toString());
        final double AG77 = Double.valueOf(TextUtils.isEmpty(processDoneMinCost.getText()) ? "0" : processDoneMinCost.getText().toString());
        final double AC77 = Double.valueOf(TextUtils.isEmpty(processDoneTotalCost.getText()) ? "0" : processDoneTotalCost.getText().toString());
        processDonePrice.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (Minsheet > V77) {
                    str = Minsheet;
                } else {
                    str = V77 / 1000 * R9 * J9;
                }
            }
        });

        processDoneTotalQty.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                //IF(B77=$B$9,$AC$9,IF(B77=$B$10,$AC$10,IF(B77=$B$11,$AC$11,IF(B77=$B$12,$AC$12,
                // IF(B77=$B$13,$AC$13,IF(B77=$B$14,$AC$14,IF(B77=$B$15,$AC$15,0)))))))*500
                if (B77.equals(B9)) {
                    str = AC9;
                }
                if (i >= 3) {
                    for (int j = 3; j <= i; j++) {//i为纵坐标，初始为2，因为初始控件id没有加到数组里，所以从3开始
                        Spinner item = (Spinner) paperParent.findViewById(ids[j][0]);
                        TextView totalReam = (TextView) paperParent.findViewById(ids[j][21]);
                        double ACX = Double.valueOf(TextUtils.isEmpty(totalReam.getText()) ? "0" : totalReam.getText().toString());
                        if (B77.equals(item.getSelectedItem().toString())) {
                            str = ACX;
                        }
                    }
                }
                str = str * 500;
                processDoneTotalQty.setText(str + "");
            }
        });

        processDoneTotalCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (Y77 > 0) {
                    str = max(Y77 * V77, AG77);
                }
                processDoneTotalCost.setText(str + "");
            }
        });

        processDoneUnitCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                //IF(AND(Y77>0,B77>0),IF($AH$5>0,MAX(AC77,AG77)/$AH$5,0),0)
                if (Y77 > 0 && !B77.isEmpty()) {
                    if (purChaseNumb > 0) {
                        str = max(AC77, AG77) / purChaseNumb;
                    }
                }
                processDoneUnitCost.setText(str + "");
            }
        });

        poceDSecndItem.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                poceDSecndGroupName.setText(itemGrpNameList.get(position).getGroupName());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        poceDSecndPdceRest.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                poceDSecndDSQ.setText(dataBean.getPrice());
                poceDSecndMould.setText(dataBean.getMould());
                poceDSecndMinCost.setText(dataBean.getMincost());
                poceDSecndLabourCost.setText(dataBean.getLabourcost());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        poceDSecndType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String code = poceDoneTypeData.get(position).getCode();
                poceDSecndTypeCode.setText(code);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });


        poceDSecndTotalQty.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                final String poceDSItem = poceDSecndItem.getSelectedItem().toString();
                if (poceDSItem.equals(B9)) {
                    str = AC9;
                }
                if (i >= 3) {
                    for (int j = 3; j <= i; j++) {//i为纵坐标，初始为2，因为初始控件id没有加到数组里，所以从3开始
                        Spinner item = (Spinner) paperParent.findViewById(ids[j][0]);
                        TextView totalReam = (TextView) paperParent.findViewById(ids[j][21]);
                        double ACX = Double.valueOf(TextUtils.isEmpty(totalReam.getText()) ? "0" : totalReam.getText().toString());
                        if (poceDSItem.equals(item.getSelectedItem().toString())) {
                            str = ACX;
                        }
                    }
                }
                str = str * 500;
                poceDSecndTotalQty.setText(str + "");
            }
        });
        final Double mincost = Double.valueOf(TextUtils.isEmpty(poceDSecndMinCost.getText().toString()) ? "0" : poceDSecndMinCost.getText().toString());

        poceDSecndTotalCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                Double totalQty = Double.valueOf(TextUtils.isEmpty(poceDSecndTotalQty.getText().toString()) ? "0" : poceDSecndTotalQty.getText().toString());
                Double dSheet = Double.valueOf(TextUtils.isEmpty(poceDSecndDSheet.getText().toString()) ? "0" : poceDSecndDSheet.getText().toString());
                Double pcs = Double.valueOf(TextUtils.isEmpty(poceDSecndPcs.getText().toString()) ? "0" : poceDSecndPcs.getText().toString());
                Double mould = Double.valueOf(TextUtils.isEmpty(poceDSecndMould.getText().toString()) ? "0" : poceDSecndMould.getText().toString());

                if (totalQty > 0) {
                    str = max(totalQty * dSheet + pcs * mould, mincost);
                }
                poceDSecndTotalCost.setText(str + "");
            }
        });
        final Double totalCost = Double.valueOf(TextUtils.isEmpty(poceDSecndTotalCost.getText().toString()) ? "0" : poceDSecndTotalCost.getText().toString());
        poceDSecndUnitCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb > 0 && titleN > 0) {
                    str = max(totalCost, mincost) / purChaseNumb / titleN;
                }
                poceDSecndUnitCost.setText(str + "");
            }
        });

        setBKBClick();
        setAOOICClick();
        setFOBClick();
        setGIFClick();
        setDOCClick();
        setToalCostRateClick();
    }

    private void setToalCostRateClick() {

        TotalHKD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(paperTotalCostList) + getListValue(printingTotalCostList) + getListValue(progressTotalCostList)
                        + getListValue(finishTotalCostList) + getListValue(poceDSecndTotalCostList) + getListValue(bindingTotalCostList)
                        + getListValue(acesoTotalCostList) + getListValue(fobTotalCostList) + getListValue(gifTotalCostList)
                        + getListValue(docTotalCostList);
                TotalHKD.setText(str + "");
            }
        });
        TotalUSD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = doubleValue(TotalHKD.getText().toString()) / doubleValue(USDRate.getText().toString(), true);
                TotalUSD.setText(str + "");
            }
        });
        HKD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = doubleValue(TotalHKD.getText().toString()) * doubleValue(MakeUpRate.getText().toString()) / 100;
                HKD.setText(str + "");
            }
        });
        USD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = doubleValue(TotalUSD.getText().toString()) * doubleValue(MakeUpRate.getText().toString()) / 100;
                USD.setText(str + "");
            }
        });
        PaperCostRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(paperTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                PaperCostRate.setText(str + "");
            }
        });
        progressCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(progressTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                progressCstRate.setText(str + "");
            }
        });
        printCostRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(printingTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                printCostRate.setText(str + "");
            }
        });
        finishCostRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(finishTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                finishCostRate.setText(str + "");
            }
        });
        ScndPoceCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(poceDSecndTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                ScndPoceCstRate.setText(str + "");
            }
        });
        BindCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(bindingTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                BindCstRate.setText(str + "");
            }
        });

        AcesCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(acesoTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                AcesCstRate.setText(str + "");
            }
        });
        PackCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(paperTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                PackCstRate.setText(str + "");
            }
        });
        fobCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(fobTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                fobCstRate.setText(str + "");
            }
        });
        gifCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(gifTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                gifCstRate.setText(str + "");
            }
        });
        docCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = getListValue(docTotalCostList) / (doubleValue(TotalHKD.getText().toString(), true) * 100);
                docCstRate.setText(str + "");
            }
        });
        TotalCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = doubleValue(PaperCostRate.getText().toString()) + doubleValue(progressCstRate.getText().toString())
                        + doubleValue(printCostRate.getText().toString()) + doubleValue(finishCostRate.getText().toString())
                        + doubleValue(ScndPoceCstRate.getText().toString()) + doubleValue(BindCstRate.getText().toString())
                        + doubleValue(AcesCstRate.getText().toString()) + doubleValue(PackCstRate.getText().toString())
                        + doubleValue(fobCstRate.getText().toString()) + doubleValue(gifCstRate.getText().toString())
                        + doubleValue(docCstRate.getText().toString());
                TotalCstRate.setText(str + "");
            }
        });
        WstgCstRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb > 0) {
                    str = getListValue(totalWeightList) / purChaseNumb / getListValue(kgCopyList, true) * 1000;
                }
                str = str * 100;
                WstgCstRate.setText(str + "");
            }
        });
    }

    private double getListValue(ArrayList<Double> list) {
        double result = 0;
        int size = list.size();
        for (int j = 0; j < size; j++) {
            result = result + list.get(j);
        }
        return result;
    }

    private double getListValue(ArrayList<Double> list, boolean isDicsior) {
        double result = 0;
        int size = list.size();
        for (int j = 0; j < size; j++) {
            result = result + list.get(j);
        }
        if (isDicsior) {
            if (result == 0) {
                return 1;
            }
        }
        return result;
    }

    private void setDOCClick() {
        //=IF(V120="FOB HK",0,        IF(V120="FOB YT",0,       IF(V120="HK Local",0,IF(V120="Nil.",1,0))))
        //=IF(V120="FOB HK",0,        IF(V120="FOB YT",0,       IF(V120="HK Local",1,IF(V120="Nil.",0,0))))
        //=IF(V120="FOB HK",975*1.05, IF(V120="FOB YT",1274*1.1,IF(V120="HK Local",0,IF(V120="Nil.",0,0))))
        //=IF(V120="FOB HK",(100+350+350+5+600+261+(265/0.8))*1.05,
        // IF(V120="FOB YT",((360+15+16+300+300+200)/0.8*1.1+45*7.75*1.1),
        // IF(V120="HK Local",0,IF(V120="Nil.",0,0))))
        final ArrayList<DocPrice> docPricesList = new ArrayList<>();
        docPricesList.add(new DocPrice(0, 0, 0, 1));
        docPricesList.add(new DocPrice(0, 0, 1, 1));
        docPricesList.add(new DocPrice(975 * 1.05, 1274 * 1.1, 0, 1));
        docPricesList.add(new DocPrice((100 + 350 + 350 + 5 + 600 + 261 + (265 / 0.8)) * 1.05,
                ((360 + 15 + 16 + 300 + 300 + 200) / 0.8 * 1.1 + 45 * 7.75 * 1.1), 0, 1));

        for (int j = 0; j < 4; j++) {
            final int m = j;
            final TextView unitCost = (TextView) DOCFOBCostParent.findViewById(doc_ids[m][5]);
            unitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    String totalCost = ((TextView) DOCFOBCostParent.findViewById(doc_ids[m][4])).getText().toString();
                    Double AC130 = Double.valueOf(TextUtils.isEmpty(totalCost) ? "0" : totalCost);
                    String mincost = ((EditText) DOCFOBCostParent.findViewById(doc_ids[m][3])).getText().toString();
                    Double AG130 = Double.valueOf(TextUtils.isEmpty(mincost) ? "0" : mincost);
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(AC130, AG130) / purChaseNumb / titleN;
                    }
                    unitCost.setText(str + "");
                }
            });
        }
        final TextView totalCost1 = (TextView) DOCFOBCostParent.findViewById(doc_ids[0][4]);
        final TextView mincost = (TextView) DOCFOBCostParent.findViewById(doc_ids[3][3]);
        //=IF(V120="HK Local",IF($Q$135="交香港寫字樓",200,0)+IF(V120="HK Local",IF($Q$135="交香港倉",660,0)),0)
        final TextView totalCost2 = (TextView) DOCFOBCostParent.findViewById(doc_ids[1][4]);
        //=MAX(W134*Y134+W135*Y135+Y136*W136+Y137*W137,AG137)
        TextView totalCost4 = (TextView) DOCFOBCostParent.findViewById(doc_ids[3][4]);

        SpFOBType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                final String fobType = SpFOBType.getSelectedItem().toString();
                final String address = Spaddress.getSelectedItem().toString();
                Log.e(TAG, "SpFOBType onItemSelected: " + "fobType:" + fobType + "-***-address" + address);
                final String AE175 = "HK Local deliver 雜費+停車場費+碼頭費";
                final String AE176 = "停車場費用(HKD10-100/小時),視情況調整";
                double mincostStr = 0;
                double totalcostStr = 0;
                if (fobType.contains("HK Local")) {
                    if (address.contains("交香港寫字樓")) {
                        mincostStr = 700;
                        totalcostStr = 200;
                    }
                    if (address.contains("交香港倉")) {
                        mincostStr = mincostStr + 1270;
                        totalcostStr = 660;
                    }
                    mincost.setText(mincostStr + "");
                    totalCost2.setText(totalcostStr + "");
                }

                for (int j = 0; j < 4; j++) {
                    final int m = j;
                    final DocPrice docPrice = docPricesList.get(m);
                    final TextView price = (TextView) DOCFOBCostParent.findViewById(doc_ids[m][1]);
                    double priceStr = 0;
                    if (fobType.contains("FOB HK")) {
                        priceStr = docPrice.getElement1();
                    } else if (fobType.contains("FOB YT")) {
                        priceStr = docPrice.getElement2();
                    } else if (fobType.contains("HK Local")) {
                        priceStr = docPrice.getElement3();
                    } else if (fobType.contains("Nil.")) {
                        priceStr = docPrice.getElement4();
                    }
                    price.setText(priceStr + "");
                }

            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        Spaddress.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                final String fobType = SpFOBType.getSelectedItem().toString();
                final String address = Spaddress.getSelectedItem().toString();
                Log.e(TAG, "Spaddress onItemSelected: " + "fobType:" + fobType + "-***-address" + address);
                final String AE175 = "HK Local deliver 雜費+停車場費+碼頭費";
                final String AE176 = "停車場費用(HKD10-100/小時),視情況調整";
                if (address.equals("交香港寫字樓")) {
                    totalCost1.setText(AE176);
                } else if (address.equals("交香港倉")) {
                    totalCost1.setText(AE175);
                }
                double mincostStr = 0;
                double totalcostStr = 0;
                if (fobType.contains("HK Local")) {
                    if (address.contains("交香港寫字樓")) {
                        mincostStr = 700;
                        totalcostStr = 200;
                    }
                    if (address.contains("交香港倉")) {
                        mincostStr = mincostStr + 1270;
                        totalcostStr = 660;
                    }
                    mincost.setText(mincostStr + "");
                    totalCost2.setText(totalcostStr + "");
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    private void setGIFClick() {


        for (int j = 0; j < 3; j++) {
            final int m = j;
            final TextView totalCost = (TextView) GIFCostParent.findViewById(gif_ids[m][4]);
            totalCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    String totalQty = ((EditText) GIFCostParent.findViewById(gif_ids[m][2])).getText().toString();
                    Double Y130 = Double.valueOf(TextUtils.isEmpty(totalQty) ? "0" : totalQty);
                    String price = ((EditText) GIFCostParent.findViewById(gif_ids[m][1])).getText().toString();
                    Double W130 = Double.valueOf(TextUtils.isEmpty(price) ? "0" : price);
                    String mincost = ((EditText) GIFCostParent.findViewById(gif_ids[m][3])).getText().toString();
                    Double AG130 = Double.valueOf(TextUtils.isEmpty(mincost) ? "0" : mincost);
                    if (Y130 > 0) {
                        str = max(Y130 * W130, AG130);
                    }
                    listReplace(m, str, gifTotalCostList);
                    totalCost.setText(str + "");
                }
            });

            final TextView unitCost = (TextView) GIFCostParent.findViewById(gif_ids[m][5]);
            unitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    String totalCost = ((TextView) GIFCostParent.findViewById(gif_ids[m][4])).getText().toString();
                    Double AC130 = Double.valueOf(TextUtils.isEmpty(totalCost) ? "0" : totalCost);
                    String mincost = ((EditText) GIFCostParent.findViewById(gif_ids[m][3])).getText().toString();
                    Double AG130 = Double.valueOf(TextUtils.isEmpty(mincost) ? "0" : mincost);
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(AC130, AG130) / purChaseNumb / titleN;
                    }
                    unitCost.setText(str + "");
                }
            });
        }

    }

    private void setFOBClick() {

        final String AB183 = "無";
        final String AB180 = "載1.7噸 ";
        final String AB181 = "載6.5噸 ";
        final String AB182 = "載7噸 ";
        final String AB178 = "FCL 20'";
        final String AB179 = "FCL 40'";
        final ArrayList<FOBItem2> item2List = new ArrayList();
        item2List.add(new FOBItem2(AB183, AB180));
        item2List.add(new FOBItem2(AB178, AB181));
        item2List.add(new FOBItem2(AB179, AB182));

        final ArrayList<FOBPrice> priceList = new ArrayList();
        priceList.add(new FOBPrice(0, 0, 2150));
        priceList.add(new FOBPrice(5557 * 1.0578, 3720 * 1.1, 2850));
        priceList.add(new FOBPrice(6472 * 1.05, 4931 * 1.1, 3300));
        priceList.add(new FOBPrice(0, 0, 200 + 80));
        priceList.add(new FOBPrice(0, 0, 0));
        priceList.add(new FOBPrice(3, 5, 0));
        priceList.add(new FOBPrice(10, 8, 0));
        priceList.add(new FOBPrice(12, 10, 0));


        final String fobType = SpFOBType.getSelectedItem().toString();
        for (int j = 0; j < 8; j++) {
            final int m = j;
            final TextView item1 = (TextView) FOBCostParent.findViewById(fob_ids[j][0]);
            final TextView item2 = (TextView) FOBCostParent.findViewById(fob_ids[j][1]);
            final TextView price = (TextView) FOBCostParent.findViewById(fob_ids[j][2]);
            final EditText totalQty = (EditText) FOBCostParent.findViewById(fob_ids[j][3]);
            final double Y122 = Double.valueOf(TextUtils.isEmpty(totalQty.getText().toString()) ? "0" : totalQty.getText().toString());
            final EditText minCost = (EditText) FOBCostParent.findViewById(fob_ids[j][4]);
            final TextView totalCost = (TextView) FOBCostParent.findViewById(fob_ids[j][5]);
            final TextView unitCost = (TextView) FOBCostParent.findViewById(fob_ids[j][6]);
            final String AB185 = fobItem1List.get(j).toString();
            item1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {//=+IF($V$120="FOB HK",AB185,IF($V$120="FOB YT",AB185,IF($V$120="HK Local",AB183,0)))
                    String str = "0";
                    if (fobType.contains("FOB HK")) {
                        str = AB185;
                    } else {
                        if (fobType.contains("FOB YT")) {
                            str = AB185;
                        } else {
                            if (fobType.contains("HK Local")) {
                                str = AB183;
                            }
                        }
                    }
                    item1.setText(str);
                }
            });
            if (j < 3) {
                item2.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        String str = "";
                        //=IF($V$120="FOB HK",AB183,IF($V$120="FOB YT",AB183,IF($V$120="HK Local",AB180,0)))
                        //=IF($V$120="FOB HK",AB178,IF($V$120="FOB YT",AB178,IF($V$120="HK Local",AB181,0)))
                        //=IF($V$120="FOB HK",AB179,IF($V$120="FOB YT",AB179,IF($V$120="HK Local",AB182,0)))
                        if (fobType.contains("FOB HK")) {
                            str = item2List.get(m).getAB1();
                        } else {
                            if (fobType.contains("FOB YT")) {
                                str = item2List.get(m).getAB1();
                            } else {
                                if (fobType.contains("HK Local")) {
                                    str = item2List.get(m).getAB2();
                                }
                            }
                        }
                        item2.setText(str);
                    }
                });
            }
            price.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    //=IF(V120="FOB HK",0,                     IF(V120="FOB YT",0,                 IF(V120="HK Local",2150,0)))
                    // =IF(V120="FOB HK",5557*1.05,            IF(V120="FOB YT",3720*1.1,          IF(V120="HK Local",2850,0)))
                    //=IF(V120="FOB HK",6472*1.05,             IF(V120="FOB YT",4931*1.1,          IF(V120="HK Local",3300,0)))
                    //=IF(V120="FOB HK",T118*220*1.05+110*1.05,IF(V120="FOB YT",T118*(136/0.8*1.1),IF(V120="HK Local",200+80,0)))
                    //=IF(V120="FOB HK",T115*220*1.05+5*1.05,  IF(V120="FOB YT",T115*(136/0.8*1.1),IF(V120="HK Local",(550-198)*T115,0)))
                    //=IF($V$120="FOB HK",AB193,               IF($V$120="FOB YT",AB196,0))
                    //=IF($V$120="FOB HK",AB194,               IF($V$120="FOB YT",AB197,0))
                    //=IF($V$120="FOB HK",AB195,               IF($V$120="FOB YT",AB198,0))
                    if (fobType.contains("FOB HK")) {
                        str = priceList.get(m).getElement1();
                    } else {
                        if (fobType.contains("FOB YT")) {
                            str = priceList.get(m).getElement2();
                        } else {
                            if (fobType.contains("HK Local")) {
                                str = priceList.get(m).getElement3();
                            }
                        }
                    }
                    if (m >= 5) {
                        price.setText(str + "T");
                    } else {
                        price.setText(str + "");
                    }
                }
            });
            totalCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
//IF(Y122>0,MAX(Y122*W122,AG122),0)
                    final double W122 = Double.valueOf(TextUtils.isEmpty(price.getText().toString()) ? "0" : price.getText().toString());
                    final double AG122 = Double.valueOf(TextUtils.isEmpty(minCost.getText().toString()) ? "0" : minCost.getText().toString());
                    if (Y122 > 0) {
                        str = max(Y122 * W122, AG122);
                    }
                    listReplace(m, str, fobTotalCostList);
                    totalCost.setText(str + "");
                }
            });
            unitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
//=IF($AH$5>0,MAX(AC122,AG122)/$AH$5,0)
                    final double AG122 = Double.valueOf(TextUtils.isEmpty(minCost.getText().toString()) ? "0" : minCost.getText().toString());
                    final double AC122 = Double.valueOf(TextUtils.isEmpty(totalCost.getText().toString()) ? "0" : totalCost.getText().toString());
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(AC122, AG122) / purChaseNumb / titleN;
                    }
                    unitCost.setText(str + "");
                }
            });
        }
    }

    private void setAOOICClick() {
        AOOICTotalCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                double aooicQtyPcs = Double.valueOf(TextUtils.isEmpty(AOOICQtyPcs.getText().toString()) ? "0" : AOOICQtyPcs.getText().toString());
                double aooicPrice = Double.valueOf(TextUtils.isEmpty(AOOICPrice.getText().toString()) ? "0" : AOOICPrice.getText().toString());
                double aooicWastage = Double.valueOf(TextUtils.isEmpty(AOOICWastage.getText().toString()) ? "0" : AOOICWastage.getText().toString());
                if (purChaseNumb > 0) {
                    str = aooicQtyPcs * aooicPrice * purChaseNumb * titleN * (aooicWastage + 1);
                }
                AOOICTotalCost.setText(str + "");
            }
        });

        AOOICUnitCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double aooicTotalCost = Double.valueOf(TextUtils.isEmpty(AOOICTotalCost.getText().toString()) ? "0" : AOOICTotalCost.getText().toString());
                double aooicMinCost = Double.valueOf(TextUtils.isEmpty(AOOICMincost.getText().toString()) ? "0" : AOOICMincost.getText().toString());
                double str = 0;
                if (purChaseNumb > 0 && titleN > 0) {
                    str = max(aooicMinCost, aooicTotalCost) / purChaseNumb / titleN;
                }
                AOOICUnitCost.setText(str + "");
            }
        });
    }

    private void setBKBClick() {

        BKBPodueRest.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                BKBHourPrice.setText(dataBean.getPrice());
                BKBMinCost.setText(dataBean.getMincost());
                BKBMinPrice.setText(dataBean.getMinprice());
                BKBHandSeconds.setText(dataBean.getHandSeconds());
                BKBHandCFCient.setText(dataBean.getHandCoefficient());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        BKBItem.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String code = poceDoneTypeData.get(position).getCode();
                BKBTypeCode.setText(code);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
        BKBTotalCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Double price = Double.valueOf(TextUtils.isEmpty(BKBHourPrice.getText().toString()) ? "0" : BKBHourPrice.getText().toString());
                Double minprice = Double.valueOf(TextUtils.isEmpty(BKBMinPrice.getText().toString()) ? "0" : BKBMinPrice.getText().toString());
                Double numb = Double.valueOf(TextUtils.isEmpty(BKBNumb.getText().toString()) ? "0" : BKBNumb.getText().toString());
                Double handSeconds = Double.valueOf(TextUtils.isEmpty(BKBHandSeconds.getText().toString()) ? "0" : BKBHandSeconds.getText().toString());
                Double handCeffcient = Double.valueOf(TextUtils.isEmpty(BKBHandCFCient.getText().toString()) ? "0" : BKBHandCFCient.getText().toString());
                double str = numb * purChaseNumb + titleN * handSeconds * handCeffcient * max(price, minprice);
                BKBTotalCost.setText(str + "");
            }
        });
        BKBUnitCost.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Double totalCost = Double.valueOf(TextUtils.isEmpty(BKBTotalCost.getText().toString()) ? "0" : BKBTotalCost.getText().toString());
                Double minCost = Double.valueOf(TextUtils.isEmpty(BKBMinCost.getText().toString()) ? "0" : BKBMinCost.getText().toString());
                double str = 0;
                if (purChaseNumb > 0 && titleN > 0) {
                    str = max(totalCost, minCost) / titleN / purChaseNumb;
                }
                BKBUnitCost.setText(str + "");
            }
        });
    }


    public double max(double a, double b) {
        double str = 0;
        if (a > b) {
            str = a;
        } else {
            str = b;
        }
        return str;
    }

    private void setPaperClick(final double J9, final double L9, final double P9, final double U9, final double R9,
                               final double N9, final double I9, final double AG9,
                               final double Y9, final double C9, final double AN9, final double E9, final double G9, final double AO9,
                               final double AC9, final double W9) {

        item1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                printItem1.setText(item1.getSelectedItem().toString());
                processItem.setText(item1.getSelectedItem().toString());
                //processDoneItem.setText(item1.getSelectedItem().toString());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });


        final PaperItemGrpName paperItemGrpName = new PaperItemGrpName();
        groupName1.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                k++;
                printGroupName1.setText(groupName1.getText().toString());
                processGroupName.setText(groupName1.getText().toString());
                paperItemGrpName.setItem(item1.getSelectedItem().toString());
                paperItemGrpName.setGroupName(s.toString());
                if (k == 1) {
                    itemGrpNameList.add(paperItemGrpName);
                    poceDoneitemList.add(item1.getSelectedItem().toString());
                }
                itemGrpNameList.set(0, paperItemGrpName);
                poceDoneitemList.set(0, item1.getSelectedItem().toString());
                poceDoneItemAdapter = new ArrayAdapter<String>(getContext(),
                        android.R.layout.simple_spinner_dropdown_item, poceDoneitemList);
                poceDoneItemAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                processDoneItem.setAdapter(poceDoneItemAdapter);
                poceDSecndItem.setAdapter(poceDoneItemAdapter);
            }
        });

        PaperMoneyType1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                ExchangeRate.DataBeanX.DataBean dataBean = exchangeRateData.get(position);
                PaperMoneyRate1.setText(dataBean.getRate());
                PaperMoneyRate1.setTag(dataBean.getCode());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        PaperDgsm1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String[] strings = PaperTypeName1.getSelectedItem().toString().split("-");
                String typename = strings[0];
                String paperType = strings[1];

                Log.e(TAG, "typename: " + strings[0] + "paperType:" + strings[1] +
                        "gsm:" + PaperGsm1.getText()
                        + "code:" + PaperMoneyRate1.getTag().toString());
//                        moneyRate.getTag().toString() );
//                        mPresenter.getDGsm(strings[0],strings[1],
//                                ""+getEditTextText(paperParent,ids[finalM][12]),
//                        moneyRate.getTag().toString());

                findPaperGsm(strings[0], strings[1],
                        "" + PaperGsm1.getText(),
                        PaperMoneyRate1.getTag().toString(), PaperDgsm1);

            }
        });


        PaperDReam1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 涉及到的有paper_gsm(P9),Layout_L(J9),Layout_W(L9),Paper_$/Gsm(U9),Paper_TypeNumb(R9),Item(B9)
                double str = 0;

                if (null != item1.getSelectedItem()) {
                    String classNameItem = PaperTypeName1.getSelectedItem().toString();
                    if (!classNameItem.contains("PVC") && !classNameItem.contains("APET") && !classNameItem.contains("進口")) {
                        str = J9 * L9 * P9 * U9 / 1333;
                    }
                    if (classNameItem.contains("PVC")) {
                        if (R9 >= 0.1 && R9 < 0.175) {
                            str = J9 * L9 * 6.45 / 10000 * 1.4 * R9 * 17.33 / 500;
                        }
                        if (R9 > 0.175 && R9 <= 0.5) {
                            str = J9 * L9 * 6.45 / 10000 * 1.4 * R9 * 13 / 500;
                        }
                    }
                    if (P9 == 0) {
                        str = J9 * L9 * U9 / 2;
                    }
                    if (classNameItem.contains("APET") && R9 > 0.175 && R9 <= 0.5) {
                        str = J9 * L9 * 6.45 / 10000 * 1.4 * R9 * 14.1 / 500;
                    }
                    if (classNameItem.contains("進口") && R9 >= 0.1 && R9 <= 0.175) {
                        str = J9 * L9 * 6.45 / 10000 * 1.4 * R9 * 18.15 / 500;
                    }
                }
                Log.e(TAG, "onClick: " + str);
                PaperDReam1.setText(str + "");
            }
        });

        PaperSet1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;

                if (N9 > 0) {
                    str = 1 > I9 / N9 ? 1 : I9 / N9;
                }
                PaperSet1.setText("" + str);
            }
        });

        WastFPPlate1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (item1.getChildCount() >= 1) {
                    str = I9 / N9 / AG9 * 0.05 + 400;
                }
                Log.e(TAG, "onClick: " + str);
                WastFPPlate1.setText("" + str);
            }
        });

        TotalReam1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb != 0) {
                    if (AG9 > 0) {
                        if (N9 > 0) {
                            if (purChaseNumb > 0)
                                str = (I9 / N9 * purChaseNumb + Y9 * AG9) / 500;
                        } else {
                            TotalReam1.setText("-");
                            return;
                        }
                    }
                    str = I9 / N9 / AG9 * 0.05 + 400;
                }
                TotalReam1.setText("" + str);
            }
        });

        mmCopy1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;
                if (purChaseNumb != 0) {

                    if (R9 > 0) {
                        str = R9 * C9;
                    } else if (S9.contains("w/f")) {
                        str = C9 * 0.13 * P9 / 100;
                    } else if (S9.contains("matt")) {
                        str = C9 * 0.0974 * P9 / 100;
                    } else if (S9.contains("c1s")) {
                        str = C9 * 0.136 * P9 / 100;
                    } else if (S9.contains("c2s")) {
                        str = C9 * 0.108 * P9 / 100;
                    } else if (S9.contains("CCNB")) {
                        str = C9 * 0.132 * P9 / 100;
                    } else if (S9.contains("glossy")) {
                        str = C9 * 0.082 * P9 / 100;
                    }
                    str = str * AN9;
                }
                mmCopy1.setText("" + str);
            }
        });

        kgCopy1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;

                if (C9 > 0) {
                    if (!selectedItem.contains("PVC") && !selectedItem.contains("APET") && !selectedItem.contains("PET") && !selectedItem.contains("進口")) {
                        str = E9 * G9 * P9 * C9 / 1405 / 500 / 2.205 * AO9;
                    } else {
                        str = C9 * E9 * G9 * 6.45 / 10000 * R9 * 1.4;
                    }
                }
                kgCopy1.setText("" + str);
            }
        });

        totalWegt1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;

                if (C9 > 0) {
                    if (!selectedItem.contains("PVC") && !selectedItem.contains("APET") && !selectedItem.contains("PET") && !selectedItem.contains("進口")) {
                        str = J9 * L9 * P9 * AC9 / 1333 / 2325;
                    } else {
                        str = C9 * J9 * L9 * 6.45 / 10000 * R9 * 1.4 * AC9 * 500 / 1000;
                    }
                }
                totalWegt1.setText("" + str);
            }
        });

        TotalCost1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                double str = 0;

                str = AC9 * W9;
                Log.e(TAG, "25: --" + str);
                TotalCost1.setText("" + str);
            }
        });
    }

    private void findPaperGsm(String string, String string1, String s, String s1, final TextView paperDgsm1) {
        HttpManager.getHttpApiService().findDGsm(string, string1, PaperGsm1.getText().toString(),
                PaperMoneyRate1.getTag().toString()).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<PaperDGsm>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        ToastUtil.showToast(getContext(), e.getMessage());
                    }

                    @Override
                    public void onNext(PaperDGsm paperDGsm) {
                        paperDgsm1.setText(paperDGsm.getData().getData().get(0).getGsmprice());
                    }
                });
    }

    private void findBaseWeight(String string, String string1) {

        HttpManager.getHttpApiService().findBaseWeight(string, string1).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BaseWeight>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        ToastUtil.showToast(getContext(), e.getMessage());
                    }

                    @Override
                    public void onNext(BaseWeight baseWeight) {
                        String baseWeight2 = baseWeight.getData().getData().get(0).getBaseweight();
                        baseWeight1 = doubleValue(baseWeight2);
                    }
                });
    }


    @Override
    protected void initView() {

    }

    @Override
    protected void otherViewClick(View view) {

    }

    @Override
    protected PrintPresenter loadPresenter() {
        return new PrintPresenter();
    }

    @OnClick({R.id.paperCost_add})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.paperCost_add:
                i++;//i:2~ 为行坐标,列坐标0-24
                for (int j = 0; j <= 27; j++) {
                    //添加控件，0，3，10.14为spinner;
                    if (j == 0 || j == 3 || j == 14 || j == 15) {
                        Spinner spinner = new Spinner(getContext());
                        if (j == 0) {
                            spinner.setAdapter(paperItemTypeAdapter);
                        }
                        if (j == 3) {
                            spinner.setAdapter(paperTPS_UnitAdapter);
                        }
                        if (j == 14) {
                            spinner.setAdapter(paperTypeNameAdapter);
                        }
                        if (j == 15) {
                            spinner.setAdapter(moneyTypeAdapter);
                        }
                        setView(paperParent, spinner, i, j);
                    } else if (j == 6 || 16 <= j && j <= 19 || j > 20) { //6.12.16.20.21.22.23.24为TextView
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(paperParent, textView, i, j);

                    } else {
                        //1.2.4.5.7.8.9.11.13.15.17.18.19;为EditText
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(paperParent, editText, i, j);
                    }
                }
                for (int k = 0; k <= 23; k++) {//印刷成本
                    if (k == 7 || k == 9 || k == 11 || k == 13 || k == 14) {//7,9,11,13,14为spinner
                        Spinner spinner = new Spinner(getContext());
                        if (k == 14) {
                            spinner.setAdapter(printTurnTypeAdapter);
                        } else {
                            spinner.setAdapter(printMVFontTypeAdapter);
                        }
                        setView(printParent, spinner, i, k);
                    } else if (k >= 2 && k <= 6 || k == 8 || k == 10 || k == 12 || k == 18 || k == 20 || k == 23) {//2,3,4,5,6,8,10,12,17,21为editText
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(printParent, editText, i, k);
                    } else {//0,1,15,16,18,19,20为textView13664
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(printParent, textView, i, k);
                    }
                }
                for (int j = 0; j < 13; j++) {//工序成本
                    //添加控件，2为spinner;
                    if (j == 2) {
                        Spinner spinner = new Spinner(getContext());
                        spinner.setAdapter(processKindsTypeAdapter);
                        setView(processParent, spinner, i, j);
                    } else if (j == 9 || j == 10) { //9,10为EditText
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(processParent, editText, i, j);
                    } else {
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(processParent, textView, i, j);
                    }
                }
                for (int j = 0; j < 14; j++) {//完成工序成本
                    //添加控件，2为spinner;
                    if (j == 0 || j == 2 || j == 3) {
                        Spinner spinner = new Spinner(getContext());
                        if (j == 2) {
                            spinner.setAdapter(poceDoneTypeAdapter);
                        }
                        if (j == 3) {
                            spinner.setAdapter(poceDonePduReustAdapter);
                        }
                        setView(processDoneParent, spinner, i, j);
                    } else if (j == 4 || j == 9 || j == 12) {
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(processDoneParent, editText, i, j);
                    } else {
                        //为TextView
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(processDoneParent, textView, i, j);
                    }
                }
                for (int j = 0; j <=19; j++) {//二次处理工序成本
                    //添加控件，2为spinner;
                    if (j == 0 || j == 2 || j == 3) {
                        Spinner spinner = new Spinner(getContext());
                        if (j == 2) {
                            spinner.setAdapter(poceDoneTypeAdapter);
                        }
                        if (j == 3) {
                            spinner.setAdapter(poceDonePduReustAdapter);
                        }
                        setView(poceDSendParent, spinner, i, j);
                    } else if (4 <= j && j <= 8 || j == 10 || j == 11 ||j==13|| j == 18) { //4.5.6.7.8.10.11为EditText
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(poceDSendParent, editText, i, j);
                    } else {
                        //为TextView
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(poceDSendParent, textView, i, j);
                    }
                }
                for (int j = 0; j < 13; j++) {//装订和手工作业
                    //添加控件，2为spinner;
                    if (j == 0 || j == 1 || j == 3) {
                        Spinner spinner = new Spinner(getContext());
                        if (j == 0) {
                            spinner.setAdapter(poceDoneTypeAdapter);
                        }
                        if (j == 1) {
                            spinner.setAdapter(poceDonePduReustAdapter);
                        }
                        if (j == 3) {
                            spinner.setAdapter(bkbUnitAdapter);
                        }
                        setView(bkbParent, spinner, i, j);
                    } else if (j == 2 || j == 11) { //3,4,5,6,8,11为EditText
                        EditText editText = new EditText(getContext());
                        editText.setGravity(Gravity.CENTER);
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        setView(bkbParent, editText, i, j);
                    } else {
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setGravity(Gravity.CENTER);
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        setView(bkbParent, textView, i, j);

                    }
                }
                for (int j = 0; j < 11; j++) {//Accessories or others item cost
                    //添加控件，2为spinner;
                    if (j == 8 || j == 9) {
                        TextView textView = new TextView(getContext());
                        textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        textView.setBackgroundColor(getResources().getColor(R.color.yellow));
                        textView.setGravity(Gravity.CENTER);
                        setView(AOOICParent, textView, i, j);
                    } else {
                        EditText editText = new EditText(getContext());
                        editText.setTextSize(getResources().getDimensionPixelSize(R.dimen.sp_8));
                        editText.setGravity(Gravity.CENTER);
                        setView(AOOICParent, editText, i, j);
                    }
                }
                break;
        }
        setPaperListener(ids.length);//注册纸张成本点击事件
    }


    private void setPaperListener(int j) {
        paperTotalCostList.add(Double.valueOf(TextUtils.isEmpty(TotalCost1.getText()) ? "0" : TotalCost1.getText().toString()));
        for (int m = 3; m <= i; m++) {//m为纵坐标初始为3，及第一行可编辑队列：
            for (int n = 0; n < j; n++) {//n为横坐标，初始为0，定位具体控件
                final int finalN = n;
                final int finalM = m;
                final double P9 = getEditTextText(paperParent, ids[m][12]);
                final double J9 = getEditTextText(paperParent, ids[m][7]);
                final double L9 = getEditTextText(paperParent, ids[m][8]);
                final double U9 = getTextViewText(paperParent, ids[m][16]);
                final double R9 = getEditTextText(paperParent, ids[m][13]);
                final double N9 = getEditTextText(paperParent, ids[m][10]);
                final double I9 = getTextViewText(paperParent, ids[m][6]);
                final double AG9 = getTextViewText(paperParent, ids[m][18]);
                final double Y9 = getTextViewText(paperParent, ids[m][20]);
                final double C9 = getEditTextText(paperParent, ids[m][2]);
                final double E9 = getEditTextText(paperParent, ids[m][4]);
                final double G9 = getEditTextText(paperParent, ids[m][5]);
                final double AO9 = getTextViewText(paperParent, ids[m][19]);
                final double AC9 = getTextViewText(paperParent, ids[m][21]);
                final double W9 = getTextViewText(paperParent, ids[m][17]);
                final double AN9 = getTextViewText(paperParent, ids[m][19]);
                final Spinner item = (Spinner) paperParent.findViewById(ids[m][0]);
                final Spinner s9 = (Spinner) paperParent.findViewById(ids[m][14]);//typeName
                final String S9 = s9.getSelectedItem().toString();
                final TextView moneyRate = (TextView) paperParent.findViewById(ids[m][26]);//momeyRate
                Spinner moneyType = (Spinner) paperParent.findViewById(ids[m][15]);//moneyType
//                final String moneyCode = "";
                moneyType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                    @Override
                    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                        ExchangeRate.DataBeanX.DataBean dataBean = exchangeRateData.get(position);
                        moneyRate.setText(dataBean.getRate());
                        moneyRate.setTag(dataBean.getCode());
                    }

                    @Override
                    public void onNothingSelected(AdapterView<?> parent) {

                    }
                });

                final String selectedItem = moneyType.getSelectedItem().toString();

                final TextView dGsm = (TextView) paperParent.findViewById(ids[m][16]);//Dgsm

                dGsm.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        String[] strings = s9.getSelectedItem().toString().split("-");
                        String typename = strings[0];
                        String paperType = strings[1];
                        findPaperGsm(strings[0], strings[1],
                                "" + getEditTextText(paperParent, ids[finalM][12]),
                                moneyRate.getTag().toString(), dGsm);
                    }
                });

                if (n == 0) {
                    item.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            TextView printItem = (TextView) printParent.findViewById(print_ids[finalM][0]);
                            TextView processItem = (TextView) processParent.findViewById(process_ids[finalM][0]);
                            printItem.setText(item.getSelectedItem().toString());
                            processItem.setText(item.getSelectedItem().toString());
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {

                        }
                    });
                }
                if (n == 1) {//通过纸张成本item的值确定印刷成本，工序成本的item的值
                    k = 0;
                    final EditText editText = (EditText) paperParent.findViewById(ids[m][n]);
                    final PaperItemGrpName paperItemGrpName = new PaperItemGrpName();
                    editText.addTextChangedListener(new TextWatcher() {
                        @Override
                        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

                        }

                        @Override
                        public void onTextChanged(CharSequence s, int start, int before, int count) {

                        }

                        @Override
                        public void afterTextChanged(Editable s) {
                            k++;
                            TextView groupname = (TextView) printParent.findViewById(print_ids[finalM][1]);
                            TextView procesGroupname = (TextView) processParent.findViewById(process_ids[finalM][1]);
                            groupname.setText(s.toString());
                            procesGroupname.setText(s.toString());
                            paperItemGrpName.setItem(item.getSelectedItem().toString());
                            paperItemGrpName.setGroupName(s.toString());

                            if (k == 1) {
                                itemGrpNameList.add(paperItemGrpName);
                                poceDoneitemList.add(item.getSelectedItem().toString());
                            }
                            itemGrpNameList.set(finalM - 2, paperItemGrpName);
                            poceDoneitemList.set(finalM - 2, item.getSelectedItem().toString());
                        }
                    });

                }
                if (n == 2) {//通过tps_numb的值确定layout_numb的值
                    Log.e(TAG, "setListener: " + "m=" + m + "--n=" + n);
                    EditText v = (EditText) paperParent.findViewById(ids[m][n]);
                    v.addTextChangedListener(new TextWatcher() {
                        @Override
                        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

                        }

                        @Override
                        public void onTextChanged(CharSequence s, int start, int before, int count) {

                        }

                        @Override
                        public void afterTextChanged(Editable s) {
                            TextView lyoutNumbAuto = (TextView) paperParent.findViewById(ids[finalM][finalN + 4]);
                            int str = Integer.valueOf(s.toString()) * Integer.valueOf(
                                    TextUtils.isEmpty(titleNumb.getText()) ? "0" : titleNumb.getText().toString());
                            lyoutNumbAuto.setText(str + "");
                        }
                    });
                }
                final Spinner B9 = (Spinner) paperParent.findViewById(ids[finalM][0]);
                if (n == 17) {//点击paper_$/Ream以确定该值，
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    Log.e(TAG, "onlistener: ");
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = getEditTextText(paperParent, ids[finalM][10]) * getEditTextText(paperParent, ids[finalM][11]);
                            String[] strings = s9.getSelectedItem().toString().split("-");
                            String typename = strings[0];
                            String paperType = strings[1];
                            if (typename.contains("紙張")) {
                                //PaperLength * PaperWidth* GSM * $Gsm/thousqinch/KG / 1333
                                str = str * getEditTextText(paperParent, ids[finalM][12]) * getEditTextText(paperParent, ids[finalM][16]) / 1333;
                            } else if (typename.contains("坑紙")) {
                                //paperLength*paperWidth * 6.45 / 10000 * 1.4 *PaperTypeNumb * $Gsm/thousqinch/KG * 500
                                str = str * 6.45 / 10000 * 1.4 * getEditTextText(paperParent, ids[finalM][13]) * getEditTextText(paperParent, ids[finalM][12]) * 500;
                            } else if (typename.contains("膠片")) {
                                //paperLength*paperWidth * 6.45 / 10000 * 1.4 * PaperTypeNumb * $Gsm/thousqinch/KG * 500
                                str = str * 6.45 / 10000 * 1.4 * getEditTextText(paperParent, ids[finalM][13]) * getEditTextText(paperParent, ids[finalM][12]) * 500;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 18) {//IF(N9>0,MAX(I9/N9,1),0)
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (N9 > 0) {
                                str = 1 > I9 / N9 ? 1 : I9 / N9;
                            }
                            Log.e(TAG, "onClick: " + str);
                            textView.setText("" + str);
                        }
                    });

                }
                if (n == 20) {//Qualitynumb * titlenumb / layoutups/ noplateset* WastageRate/ 100 + PrintWastage
//IF(B9>0,$C$5*I9/N9/AG9*0.05+400,0) I9为Layout_Numb,N9为Lyout_ups,AG9为No. of plate  set
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;

                            if (B9.getChildCount() >= 1) {
                                str = I9 / N9 / AG9 * 0.05 + 400;
                            }
                            Log.e(TAG, "onClick: " + str);
                            textView.setText("" + str);
                        }
                    });
                }
                if (n == 21) {//IF($AC$8>0,IF(AG9>0,IF(N9>0,IF($V$5>0,(I9/N9*$C$5+Y9*AG9)/500,"-"),0),0),0)
//$AC$8,$C$5为印刷数量，AG9为No. of plate  set，I9为Layout_Numb,N9为Lyout_ups，Y9为Wastage for per plate
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;

                            if (purChaseNumb != 0) {
                                if (AG9 > 0) {
                                    if (N9 > 0) {
                                        if (purChaseNumb > 0)
                                            str = (I9 / N9 * purChaseNumb + Y9 * AG9) / 500;
                                    } else {
                                        textView.setText("-");
                                        return;
                                    }
                                }
                                str = I9 / N9 / AG9 * 0.05 + 400;
                            }
                            textView.setText("" + str);
                        }
                    });
                }
                if (n == 22) {//IF(R9>0,R9*C9,IF(S9="w/f",C9*0.13*P9/100,IF(S9="matt",C9*0.0974*P9/100,IF(S9="c1s",C9*0.136*P9/100,IF(S9="c2s",C9*0.108*P9/100,IF(S9="CCNB",C9*0.132*P9/100,IF(S9="glossy",C9*0.082*P9/100,0)))))))*AN9
//C9为TPS_numb,S9为PaperTypeName,AN9为Leaf
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            double purChaseNumb = Double.valueOf(TextUtils.isEmpty(EdPurchaseNum.getText().toString()) ? "0" : EdPurchaseNum.getText().toString());
                            if (purChaseNumb != 0) {
                                if (R9 > 0) {
                                    str = R9 * C9;
                                } else if (S9.contains("w/f")) {
                                    str = C9 * 0.13 * P9 / 100;
                                } else if (S9.contains("matt")) {
                                    str = C9 * 0.0974 * P9 / 100;
                                } else if (S9.contains("c1s")) {
                                    str = C9 * 0.136 * P9 / 100;
                                } else if (S9.contains("c2s")) {
                                    str = C9 * 0.108 * P9 / 100;
                                } else if (S9.contains("CCNB")) {
                                    str = C9 * 0.132 * P9 / 100;
                                } else if (S9.contains("glossy")) {
                                    str = C9 * 0.082 * P9 / 100;
                                }
                                str = str * AN9;
                            }
                            textView.setText("" + str);
                        }
                    });
                }
                if (n == 23) {//kg/copy
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            String[] strings = s9.getSelectedItem().toString().split("-");
                            String typename = strings[0];
                            String paperType = strings[1];
                            if (typename.contains("紙張")) {
                                //TPSLength * TPSWidth * GSM * TpsUnitNumb/ 1405 / 500 / 2.205 * IIf(TpsUnit = "PP", 0.5, IIf(TpsUnit = "pcs", 1, IIf(TpsUnit = "SP", 1, 0)))
                                str = getEditTextText(paperParent, ids[finalM][4]) * getEditTextText(paperParent, ids[finalM][5]) * getEditTextText(paperParent, ids[finalM][12])
                                        * getEditTextText(paperParent, ids[finalM][2]) / 1405 / 500 / 2.205;
                                Spinner tpUnit = (Spinner) paperParent.findViewById(ids[finalM][3]);
                                String tpUnitString = tpUnit.getSelectedItem().toString();
                                if (tpUnitString.contains("PP")) {
                                    str = str * 0.5;
                                } else if (tpUnitString.contains("pcs")) {
                                    str = str * 1;
                                } else if (tpUnitString.contains("SP")) {
                                    str = str * 1;
                                } else {
                                    str = str * 0;
                                }
                            } else if (typename.contains("坑紙")) {
                                //TPSLength * TPSWidth / 1000 * BaseWeight
                                findBaseWeight(typename, paperType);
                                str = getEditTextText(paperParent, ids[finalM][4]) * getEditTextText(paperParent, ids[finalM][5]) / 1000 * baseWeight1;
                            } else if (typename.contains("膠片")) {
                                // paperLength*paperWidth*TpsUnitNumb*6.45/10000*PaperTypeNumb*1.4
                                str = getEditTextText(paperParent, ids[finalM][10]) * getEditTextText(paperParent, ids[finalM][11])
                                        * getEditTextText(paperParent, ids[finalM][2]) * 6.45 / 10000 * 1.4 * getEditTextText(paperParent, ids[finalM][13]);
                            }
                            textView.setText("" + str);
                        }
                    });
                }
                if (n == 24) {//IF(C9>0,IF(AND(P9<>"PVC",P9<>"APET",P9<>"PET",P9<>"進口"),J9*L9*P9*AC9/1333/2325,C9*J9*L9*6.45/10000*R9*1.4*AC9*500/1000),0)
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (C9 > 0) {
                                if (!selectedItem.contains("PVC") && !selectedItem.contains("APET") && !selectedItem.contains("PET") && !selectedItem.contains("進口")) {
                                    str = J9 * L9 * P9 * AC9 / 1333 / 2325;
                                } else {
                                    str = C9 * J9 * L9 * 6.45 / 10000 * R9 * 1.4 * AC9 * 500 / 1000;
                                }
                                listReplace(finalM, str, totalWeightList);
                            }
                            Log.e(TAG, "24:--" + str);
                            textView.setText("" + str);
                        }
                    });
                }
                if (n == 25) {//AC9*W9----Total Ream*DReam
                    final TextView textView = (TextView) paperParent.findViewById(ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            str = AC9 * W9;
                            listReplace(finalM - 2, str, paperTotalCostList);
                            textView.setText("" + str);
                        }
                    });

                }
            }
        }
        setPritingListener(print_ids.length);//注册印刷成本点击事件
        setProcessDonelistener(processDone_ids.length);
        setPoceDSecndlistener(poceDSecnd_ids.length);
        setBKBListener();
        setAOOICListener();
    }

    private double getEditTextText(GridLayout parent, int id) {
        String text = ((EditText) parent.findViewById(id)).getText().toString();
        return doubleValue(text);
    }

    private void listReplace(int i, double str, List<Double> list) {
        if (!list.isEmpty()){
            if (null != list.get(i)) {
                list.set(i, str);
            } else {
                list.add(str);
            }
        }else {
            list.add(str);
        }
    }

    private void findMopocedure() {

        HttpManager.getHttpApiService().findMopocedure().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<Mopocedure>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        ToastUtil.showToast(getContext(), e.getMessage());
                    }

                    @Override
                    public void onNext(Mopocedure mopocedure) {
                        Mopocedure.DataBeanX.DataBean dataBean = mopocedure.getData().getData().get(0);
                        mopocedureN = dataBean;
                    }
                });
    }

    private void setPritingListener(int j) {

        printingTotalCostList.add(Double.valueOf(TextUtils.isEmpty(printTotalcost1.getText()) ? "0" : printTotalcost1.getText().toString()));
        for (int m = 3; m <= i; m++) {//m为纵坐标初始为2，及第一行可编辑队列：
            for (int n = 0; n < j; n++) {//n为横坐标，初始为0，定位具体控件
                final int k = n;
                final int finalM = m;
                final double P9 = getEditTextText(paperParent, ids[m][12]);
                final double J9 = getEditTextText(paperParent, ids[m][7]);
                final double L9 = getEditTextText(paperParent, ids[m][8]);
                final double AG9 = getTextViewText(paperParent, ids[m][18]);
                final double AC9 = getTextViewText(paperParent, ids[m][21]);

                final String D24 = SpInkType.getSelectedItem().toString();
                TextView b26 = (TextView) printParent.findViewById(print_ids[m][0]);//印刷成本里的item
                final String B26 = b26.getText().toString();
                final double C26 = getTextViewText(printParent, print_ids[m][2]);
                final double D26 = getTextViewText(printParent, print_ids[m][3]);
                final double E26 = getTextViewText(printParent, print_ids[m][4]);
                final double F26 = getEditTextText(printParent, print_ids[m][5]);
                final double G26 = getEditTextText(printParent, print_ids[m][6]);
                final double J26 = getEditTextText(printParent, print_ids[m][8]);
                final double M26 = getEditTextText(printParent, print_ids[m][10]);
                final double R26 = getEditTextText(printParent, print_ids[m][12]);
                final double Y26 = getTextViewText(printParent, print_ids[m][16]);
                final double Z26 = getTextViewText(printParent, print_ids[m][17]);
                final double W26 = getTextViewText(printParent, print_ids[m][15]);
                final double AG26 = getTextViewText(printParent, print_ids[m][18]);
                final double AT26 = getTextViewText(printParent, print_ids[m][19]);

                if (n == 15) {//IF(B26>0,IF(AND(油墨类型="soy ink",P9>157),"1.44444444444")+
// IF(AND($D$24="soy ink",P9<=157),"1.71428571428")+
// IF(AND($D$24="normal ink",P9>157),"1")+
// IF(AND($D$24="normal ink",P9<=157),"1"),0)
                    final TextView textView = (TextView) printParent.findViewById(print_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (!B26.isEmpty()) {
                                if (D24.contains("soy ink")) {
                                    if (P9 > 157) {
                                        str = 1.44444444444;
                                    } else if (P9 <= 157) {
                                        str = 1.71428571428;
                                    }
                                }
                                if (D24.contains("normal ink")) {
                                    if (P9 > 157) {
                                        str = 1;
                                    } else if (P9 <= 157) {
                                        str = 1;
                                    }
                                }
                                textView.setText(str + "");
                            }
                        }
                    });
                }
                if (n == 16) {//print_sheet   IF(AG9>0,AC9*500/AG9,0)
                    final TextView textView = (TextView) printParent.findViewById(print_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (AG9 > 0) {
                                str = AC9 * 500 / AG9;
                            }
                            textView.setText(str + "");
                        }
                    });
                }

//IF(SUM(C26:G26,J26,M26,R26)>0,IF(AND($J9>29.25,$L9>29.25),100,IF(OR($J9>41.7,$L9>41.7),100,IF(P9<=157,40,50))),0)
                final TextView printRateA = (TextView) printParent.findViewById(print_ids[m][17]);
                printRateA.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        double str = 0;
                        mopocedureN = null;
                        double conditon1 = getEditTextText(printParent, print_ids[finalM][2]) + getEditTextText(printParent, print_ids[finalM][3])
                                + getEditTextText(printParent, print_ids[finalM][4]) + getEditTextText(printParent, print_ids[finalM][5])
                                + getEditTextText(printParent, print_ids[finalM][6]) + getEditTextText(printParent, print_ids[finalM][8])
                                + getEditTextText(printParent, print_ids[finalM][10]) + getEditTextText(printParent, print_ids[finalM][12]);
                        double paperlength = getEditTextText(paperParent, ids[finalM][7]);
                        double paperWidth = getEditTextText(paperParent, ids[finalM][8]);
                        double paperGsm = getEditTextText(paperParent, ids[finalM][12]);
                        if (conditon1 > 0) {
                            if (paperlength > 29.25 && paperWidth > 29.25 || paperlength > 41.7 || paperWidth > 41.7) {
                                findMopocedure();
                                if (null != mopocedureN) {
                                    str = doubleValue(mopocedureN.getFullprintrate(), "100");
                                }
                            } else if (paperGsm > 157) {
                                str = doubleValue(mopocedureN.getCrossfoldprintrate1(), "40");
                            } else if (paperGsm <= 157) {
                                str = doubleValue(mopocedureN.getCrossfoldprintrate2(), "50");
                            }
                        }
                        printRateA.setText(str + "");
                    }
                });

                final TextView minCostA = (TextView) printParent.findViewById(print_ids[m][19]);
                minCostA.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        double str = getTextViewText(printParent, print_ids[finalM][17]) * 3 *
                                (getEditTextText(printParent, print_ids[finalM][2]) + getEditTextText(printParent, print_ids[finalM][3]) +
                                        getEditTextText(printParent, print_ids[finalM][4]) * 1.5 + getEditTextText(printParent, print_ids[finalM][5]) * 1.5 +
                                        getEditTextText(printParent, print_ids[finalM][6]) * 2 + getEditTextText(printParent, print_ids[finalM][8]) * 2 +
                                        getEditTextText(printParent, print_ids[finalM][10]) * 3 + getEditTextText(printParent, print_ids[finalM][12]) * 3) *
                                getTextViewText(paperParent, ids[finalM][18]) * getTextViewText(printParent, print_ids[finalM][15]);
                        minCostA.setText(str + "");
                    }
                });

                final TextView totalCost = (TextView) printParent.findViewById(print_ids[m][21]);//totalCost
                totalCost.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        double str = 0;
                        if (purChaseNumb > 0) {
                            double a = 0;
                            if (C26 < 1) {
                                a = C26 * 1;
                            } else {
                                a = C26;
                            }
                            if (D26 < 1) {
                                a = a + D26 * 1;
                            } else {
                                a = a + D26;
                            }
                            a = a + (G26 + J26) * 2 + (E26 + F26) * 1.5 + (M26 + R26) * 3;
                            a = a * Y26 * Z26 * AG9 / 1000 * W26;
                            if (a > AG26) {
                                str = a;
                            } else {
                                str = AG26;
                            }
                        }
                        listReplace(finalM - 2, str, printingTotalCostList);
                        totalCost.setText(str + "");
                    }
                });

                if (n == 20) {//unitCost
//IF($AH$5>0,AT26/$AH$5,0)
                    final TextView textView = (TextView) printParent.findViewById(print_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (purChaseNumb > 0) {
                                str = AT26 / purChaseNumb;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
            }
        }
        setProcesslistener(process_ids.length);
    }

    private void setProcesslistener(int j) {
        progressTotalCostList.add(Double.valueOf(TextUtils.isEmpty(processTotalCost.getText()) ? "0" : processTotalCost.getText().toString()));
        for (int m = 3; m <= i; m++) {//j为横坐标
            for (int n = 0; n < j; n++) {
                final int finalm = m;
                final double J9 = getEditTextText(paperParent, ids[m][7]);
                final double L9 = getEditTextText(paperParent, ids[m][8]);
                final double AG9 = getTextViewText(paperParent, ids[m][18]);
                final double C26 = getTextViewText(printParent, print_ids[m][2]);
                final double D26 = getEditTextText(printParent, print_ids[m][3]);
                final double E26 = getEditTextText(printParent, print_ids[m][4]);
                final double F26 = getEditTextText(printParent, print_ids[m][5]);
                final double G26 = getEditTextText(printParent, print_ids[m][6]);
                final double J26 = getEditTextText(printParent, print_ids[m][8]);
                final double M26 = getEditTextText(printParent, print_ids[m][10]);
                final double R26 = getEditTextText(printParent, print_ids[m][12]);
                final String H26 = getSpinnerText(printParent, print_ids[m][7]);
                final String O26 = getSpinnerText(printParent, print_ids[m][11]);
                final String K26 = getSpinnerText(printParent, print_ids[m][9]);
                final String S26 = getSpinnerText(printParent, print_ids[m][13]);
                final String U26 = getSpinnerText(printParent, print_ids[m][14]);
                TextView b43 = (TextView) processParent.findViewById(process_ids[m][0]);//item
                final String B43 = b43.getText().toString();
                final double M43 = getTextViewText(processParent, process_ids[m][4]);
                final double N43 = getTextViewText(processParent, process_ids[m][5]);
                final double S43 = getTextViewText(processParent, process_ids[m][7]);
                final double U43 = getTextViewText(processParent, process_ids[m][8]);
                final double P43 = getTextViewText(processParent, process_ids[m][6]);
                final double AC43 = getTextViewText(processParent, process_ids[m][12]);
                final double Y43 = getEditTextText(processParent, process_ids[m][10]);
                final String G43 = getSpinnerText(processParent, process_ids[m][2]);
                TextView k43 = (TextView) processParent.findViewById(process_ids[m][3]);//Kinds
                final String K43 = k43.getText().toString();
                final double C5 = Double.valueOf(TextUtils.isEmpty(titleNumb.getText()) ? "0" : titleNumb.getText().toString());
                final double V5 = Double.valueOf(TextUtils.isEmpty(EdPurchaseNum.getText().toString()) ? "0" : EdPurchaseNum.getText().toString());

                if (n == 3) {//procesKinds AND($J9>29.25,$L9>29.25),"L",IF(OR($J9>41.7,$L9>41.7),"L","S"))
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            String str = "";
                            if (J9 > 29.25 && L9 > 29.25) {
                                str = "L";
                            } else if (J9 > 41.7 || L9 > 41.7) {
                                str = "L";
                            } else {
                                str = "S";
                            }
                            textView.setText(str);
                        }
                    });
                }
                if (n == 4) {//processA  C26+E26+IF(H26="print",G26,0)+IF(O26="print",M26,0)
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = C26 + E26;
                            if (H26.contains("print")) {
                                str = str + G26;
                            }
                            if (O26.contains("print")) {
                                str = str + M26;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 5) {//processB  D26+F26+IF(K26="print",J26,0)+IF(S26="print",R26,0
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = D26 + F26;
                            if (K26.contains("print")) {
                                str += J26;
                            }
                            if (S26.contains("print")) {
                                str += R26;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 6) {//Process_$plate IF(B43>0,IF(G43="CTP",IF(K43="S",100,150),IF(K43="S",60,120)),0)
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (!B43.isEmpty()) {
                                if (G43.contains("CTP")) {
                                    if (K43.contains("S")) {
                                        str = 100;
                                    } else {
                                        str = 150;
                                    }
                                } else {
                                    if (K43.contains("S")) {
                                        str = 60;
                                    } else {
                                        str = 120;
                                    }
                                }
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 7) {//palteSet  AG9
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            textView.setText(AG9 + "");
                        }
                    });
                }
                if (n == 8) {//palteQty   IF(U26="turn",(M43+N43)/2*S43,(M43+N43)*S43)
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (U26.contains("turn")) {
                                str = (M43 + N43) / 2 * S43;
                            } else {
                                str = (M43 + N43) * S43;
                            }
                            textView.setText(str + "");
                        }
                    });
                }

                if (n == 11) {//UnitCost  IF($C$5>0,AC43/$C$5/$V$5,0) c5qutilNumb v5titleNumb
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (C5 > 0 && V5 > 0) {
                                str = AC43 / C5 / V5;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 12) {//TotalCost  IF($AC$42>0,U43*P43,0)*Y43
                    final TextView textView = (TextView) processParent.findViewById(process_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (V5 > 0) {
                                str = U43 * P43;
                            }
                            str = str * Y43;
                            listReplace(finalm - 2, str, progressTotalCostList);
                            textView.setText(str + "");
                        }
                    });
                }

            }
        }
    }

    private String getSpinnerText(GridLayout parent, int id) {
        Spinner spinner = (Spinner) parent.findViewById(id);//print_MvFontType
        return spinner.getSelectedItem().toString();
    }

    private void setProcessDonelistener(int j) {
        finishTotalCostList.add(Double.valueOf(TextUtils.isEmpty(processDoneTotalCost.getText()) ? "0" : processTotalCost.getText().toString()));
        for (int m = 3; m <= i; m++) {//j为横坐标
            for (int n = 0; n < j; n++) {
                final int finalm = m;
                final double Y77 = getTextViewText(processDoneParent, processDone_ids[m][8]);
                final TextView v77 = (TextView) processDoneParent.findViewById(processDone_ids[m][5]);
                final double V77 = getTextViewText(processDoneParent, processDone_ids[m][5]);
                final TextView ag77 = (TextView) processDoneParent.findViewById(processDone_ids[m][9]);
                final double AG77 = getTextViewText(processDoneParent, processDone_ids[m][5]);
                TextView ac77 = (TextView) processDoneParent.findViewById(processDone_ids[m][10]);
                final double AC77 = Double.valueOf(TextUtils.isEmpty(ac77.getText()) ? "0" : ac77.getText().toString());
                TextView b77 = (TextView) processDoneParent.findViewById(processDone_ids[m][1]);
                final String B77 = b77.getText().toString();
                final TextView minSheet = (TextView) processDoneParent.findViewById(processDone_ids[m][6]);
                final double MinSheet = Double.valueOf(TextUtils.isEmpty(minSheet.getText()) ? "0" : minSheet.getText().toString());
                EditText j9 = (EditText) paperParent.findViewById(ids[m][7]);
                final double J9 = Double.valueOf(TextUtils.isEmpty(j9.getText()) ? "0" : j9.getText().toString());
                EditText r9 = (EditText) paperParent.findViewById(ids[m][13]);
                final double R9 = Double.valueOf(TextUtils.isEmpty(r9.getText().toString()) ? "1" : r9.getText().toString());
                final Spinner B9 = (Spinner) paperParent.findViewById(ids[m][0]);
                TextView ac9 = (TextView) paperParent.findViewById(ids[m][21]);//Total Ream 21
                final double AC9 = Double.valueOf(TextUtils.isEmpty(ac9.getText()) ? "1" : ac9.getText().toString());
                if (n == 0) {
                    Spinner spinner = (Spinner) processDoneParent.findViewById(processDone_ids[m][n]);
                    ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(),
                            android.R.layout.simple_spinner_dropdown_item, poceDoneitemList);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    spinner.setAdapter(adapter);
                    final TextView groupName = (TextView) processDoneParent.findViewById(processDone_ids[m][1]);
                    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            groupName.setText(itemGrpNameList.get(position).getGroupName());
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {

                        }
                    });
                }
                if (n == 3) {//produceRequest
                    Spinner spinner = (Spinner) processDoneParent.findViewById(processDone_ids[m][n]);
                    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                            v77.setText(dataBean.getPrice());
                            minSheet.setText(dataBean.getMinprice());
                            ag77.setText(dataBean.getMincost());
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {

                        }
                    });
                }
                if (n == 2) {//type
                    Spinner spinner = (Spinner) processDoneParent.findViewById(processDone_ids[m][n]);
                    final TextView typeCode = (TextView) processDoneParent.findViewById(processDone_ids[m][13]);
                    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            ProcessDoneType.DataBeanX.DataBean dataBean = poceDoneTypeData.get(position);
                            typeCode.setText(dataBean.getCode());
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {

                        }
                    });
                }
                if (n == 7) {//price
                    final TextView textView = (TextView) processDoneParent.findViewById(processDone_ids[m][7]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (MinSheet > V77) {
                                str = MinSheet;
                            } else {
                                str = V77 / 1000 * R9 * J9;
                            }
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 8) {//totalQty
                    final TextView textView = (TextView) processDoneParent.findViewById(processDone_ids[m][8]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (B77.equals(B9)) {
                                str = AC9;
                            }
                            if (i >= 3) {
                                for (int j = 3; j <= i; j++) {//i为纵坐标，初始为2，因为初始控件id没有加到数组里，所以从3开始
                                    Spinner item = (Spinner) paperParent.findViewById(ids[j][0]);
                                    TextView totalReam = (TextView) paperParent.findViewById(ids[j][21]);
                                    double ACX = Double.valueOf(TextUtils.isEmpty(totalReam.getText()) ? "0" : totalReam.getText().toString());
                                    if (B77.equals(item.getSelectedItem().toString())) {
                                        str = ACX;
                                    }
                                }
                            }
                            str = str * 500;
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 10) {//totalcost
                    final TextView textView = (TextView) processDoneParent.findViewById(processDone_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            if (Y77 > 0) {
                                if (Y77 * V77 > AG77) {
                                    str = Y77 * V77;
                                } else {
                                    str = AG77;
                                }
                            }
                            listReplace(finalm - 2, str, finishTotalCostList);
                            textView.setText(str + "");
                        }
                    });
                }
                if (n == 11) {//unitcost
                    final TextView textView = (TextView) processDoneParent.findViewById(processDone_ids[m][n]);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            double str = 0;
                            //IF(AND(Y77>0,B77>0),IF($AH$5>0,MAX(AC77,AG77)/$AH$5,0),0)
                            if (Y77 > 0 && !B77.isEmpty()) {
                                if (purChaseNumb > 0) {
                                    if (AC77 > AG77) {
                                        str = AC77;
                                    } else {
                                        str = AG77;
                                    }
                                    str = str / purChaseNumb;
                                }
                            }
                            processDoneUnitCost.setText(str + "");
                        }
                    });
                }
            }
        }
    }

    private void setPoceDSecndlistener(int j) {
        poceDSecndTotalCostList.add(Double.valueOf(TextUtils.isEmpty(poceDSecndTotalCost.getText()) ? "0" : poceDSecndTotalCost.getText().toString()));
        for (int m = 3; m <= i; m++) {//j为横坐标
            final int finalm = m;
            final EditText dsheet = (EditText) poceDSendParent.findViewById(poceDSecnd_ids[m][10]);
            final EditText dSQ = (EditText) poceDSendParent.findViewById(poceDSecnd_ids[m][7]);
            final TextView labour = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][9]);
            final TextView Mould = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][12]);
            final Double mould = Double.valueOf(TextUtils.isEmpty(Mould.getText().toString()) ? "0" : Mould.getText().toString());
            final TextView mincost = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][14]);
            final Double mcost = Double.valueOf(TextUtils.isEmpty(mincost.getText().toString()) ? "0" : mincost.getText().toString());

            Spinner item = (Spinner) poceDSendParent.findViewById(poceDSecnd_ids[m][0]);
            ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(),
                    android.R.layout.simple_spinner_dropdown_item, poceDoneitemList);
            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            item.setAdapter(adapter);
            final TextView groupName = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][1]);
            item.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    groupName.setText(itemGrpNameList.get(position).getGroupName());
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });


            Spinner request = (Spinner) processDoneParent.findViewById(processDone_ids[m][3]);
            request.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                    dSQ.setText(dataBean.getPrice());
                    Mould.setText(dataBean.getMould());
                    mincost.setText(dataBean.getMincost());
                    labour.setText(dataBean.getLabourcost());
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });


            Spinner type = (Spinner) poceDSendParent.findViewById(poceDSecnd_ids[m][2]);
            final TextView typeCode = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][18]);
            type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    ProcessDoneType.DataBeanX.DataBean dataBean = poceDoneTypeData.get(position);
                    typeCode.setText(dataBean.getCode());
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });

            final String poceDSItem = item.getSelectedItem().toString();
            final TextView totalQty = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][13]);
            TextView ac9 = (TextView) paperParent.findViewById(ids[m][21]);
            final double AC9 = Double.valueOf(TextUtils.isEmpty(ac9.getText().toString()) ? "1" : ac9.getText().toString());
            totalQty.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    if (poceDSItem.equals(item1.getSelectedItem().toString())) {
                        str = AC9;
                    }
                    if (i >= 3) {
                        for (int j = 3; j <= i; j++) {//i为纵坐标，初始为2，因为初始控件id没有加到数组里，所以从3开始
                            Spinner item = (Spinner) paperParent.findViewById(ids[j][0]);
                            TextView totalReam = (TextView) paperParent.findViewById(ids[j][21]);
                            double ACX = Double.valueOf(TextUtils.isEmpty(totalReam.getText().toString()) ? "0" : totalReam.getText().toString());
                            if (poceDSItem.equals(item.getSelectedItem().toString())) {
                                str = ACX;
                            }
                        }
                    }
                    str = str * 500;
                    totalQty.setText(str + "");
                }
            });

            final EditText PCS = (EditText) poceDSendParent.findViewById(poceDSecnd_ids[m][11]);
            final Double pcs = doubleValue(PCS.getText().toString());
            final Double tQty = doubleValue(totalQty.getText().toString());
            final TextView TotalCost = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][15]);
            TotalCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    Double dodalSheet = doubleValue(dsheet.getText().toString());

                    if (tQty > 0) {
                        str = max(tQty * dodalSheet + pcs * mould, mcost);
                    }
                    listReplace(finalm - 2, str, poceDSecndTotalCostList);
                    TotalCost.setText(str + "");
                }
            });
            final Double totalCost = doubleValue(TotalCost.getText().toString());
            final TextView UnitCost = (TextView) poceDSendParent.findViewById(poceDSecnd_ids[m][16]);
            UnitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(totalCost, mcost) / purChaseNumb / titleN;
                    }
                    UnitCost.setText(str + "");
                }
            });
        }

    }

    private Double doubleValue(String s) {
        return Double.valueOf(TextUtils.isEmpty(s) ? "0" : s);
    }

    private Double doubleValue(TextView textView) {
        return Double.valueOf(TextUtils.isEmpty(textView.getText().toString()) ? "0" : textView.getText().toString());
    }

    private Double doubleValue(EditText textView) {
        return Double.valueOf(TextUtils.isEmpty(textView.getText().toString()) ? "0" : textView.getText().toString());
    }

    private Double doubleValue(String s, String def) {
        return Double.valueOf(TextUtils.isEmpty(s) ? def : s);
    }

    private Double doubleValue(String s, boolean isDicisor) {
        if (isDicisor) {
            return Double.valueOf(TextUtils.isEmpty(s) ? "1" : s);
        } else {
            return Double.valueOf(TextUtils.isEmpty(s) ? "0" : s);
        }
    }

    private void setBKBListener() {
        bindingTotalCostList.add(Double.valueOf(TextUtils.isEmpty(BKBTotalCost.getText()) ? "0" : BKBTotalCost.getText().toString()));
        for (int j = 3; j <= i; j++) {
            final int m = j;
            Spinner poduRest = (Spinner) bkbParent.findViewById(bkb_ids[j][1]);
            poduRest.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    ProcessDonePduReust.DataBeanX.DataBean dataBean = poceDPdunRest.get(position);
                    ((TextView) bkbParent.findViewById(bkb_ids[m][4])).setText(dataBean.getPrice());
                    ((TextView) bkbParent.findViewById(bkb_ids[m][8])).setText(dataBean.getMincost());
                    ((TextView) bkbParent.findViewById(bkb_ids[m][7])).setText(dataBean.getMinprice());
                    ((TextView) bkbParent.findViewById(bkb_ids[m][5])).setText(dataBean.getHandSeconds());
                    ((TextView) bkbParent.findViewById(bkb_ids[m][6])).setText(dataBean.getHandCoefficient());
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });

            Spinner item = (Spinner) bkbParent.findViewById(bkb_ids[j][0]);
            item.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    String code = poceDoneTypeData.get(position).getCode();
                    ((TextView) bkbParent.findViewById(bkb_ids[m][12])).setText(code);
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });
            final TextView totalCost = (TextView) bkbParent.findViewById(bkb_ids[j][9]);
            totalCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Double price = getTextViewText(bkbParent, bkb_ids[m][4]);
                    Double minprice = getTextViewText(bkbParent, bkb_ids[m][7]);
                    Double numb = getTextViewText(bkbParent, bkb_ids[m][2]);
                    Double handSeconds = getTextViewText(bkbParent, bkb_ids[m][5]);
                    Double handCeffcient = getTextViewText(bkbParent, bkb_ids[m][6]);
                    double str = numb * purChaseNumb + titleN * handSeconds * handCeffcient * max(price, minprice);
                    totalCost.setText(str + "");
                    listReplace(m - 2, str, bindingTotalCostList);
                }
            });
            final TextView unitCost = (TextView) bkbParent.findViewById(bkb_ids[j][10]);
            unitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Double totalCost = getTextViewText(bkbParent, bkb_ids[m][9]);
                    Double minCost = getTextViewText(bkbParent, bkb_ids[m][8]);
                    double str = 0;
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(totalCost, minCost) / titleN / purChaseNumb;
                    }
                    unitCost.setText(str + "");
                }
            });
        }
    }

    private Double getTextViewText(GridLayout parent, int id) {
        String text = ((TextView) parent.findViewById(id)).getText().toString();
        return doubleValue(text);
    }

    private void setAOOICListener() {
        acesoTotalCostList.add(Double.valueOf(TextUtils.isEmpty(AOOICTotalCost.getText()) ? "0" : AOOICTotalCost.getText().toString()));
        for (int j = 3; j <= i; j++) {
            final int m = j;
            final TextView totalCost = (TextView) AOOICParent.findViewById(aooic_ids[m][8]);
            totalCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double str = 0;
                    double aooicQtyPcs = getTextViewText(AOOICParent, aooic_ids[m][3]);
                    double aooicPrice = getTextViewText(AOOICParent, aooic_ids[m][2]);
                    double aooicWastage = getTextViewText(AOOICParent, aooic_ids[m][4]);
                    if (purChaseNumb > 0) {
                        str = aooicQtyPcs * aooicPrice * purChaseNumb * titleN * (aooicWastage + 1);
                    }
                    listReplace(m - 2, str, acesoTotalCostList);
                    totalCost.setText(str + "");
                }
            });
            final TextView unitCost = (TextView) AOOICParent.findViewById(aooic_ids[m][9]);
            unitCost.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    double aooicTotalCost = getTextViewText(AOOICParent, aooic_ids[m][8]);
                    double aooicMinCost = getTextViewText(AOOICParent, aooic_ids[m][5]);
                    double str = 0;
                    if (purChaseNumb > 0 && titleN > 0) {
                        str = max(aooicMinCost, aooicTotalCost) / purChaseNumb / titleN;
                    }
                    unitCost.setText(str + "");
                }
            });
        }
    }


    void setView(GridLayout parent, View v, int i, int j) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            GridLayout.Spec rowSpec = null;     //设置它的行和列
            GridLayout.Spec columnSpec = null;
            if (parent == paperParent) {
                v.setId(ids[i][j]);
            } else if (parent == printParent) {
                v.setId(print_ids[i][j]);
            } else if (parent == processParent) {
                v.setId(process_ids[i][j]);
            } else if (parent == processDoneParent) {
                v.setId(processDone_ids[i][j]);
            } else if (parent == poceDSendParent) {
                v.setId(poceDSecnd_ids[i][j]);
            } else if (parent == bkbParent) {
                v.setId(bkb_ids[i][j]);
            } else if (parent == AOOICParent) {
                v.setId(aooic_ids[i][j]);
            }
            rowSpec = GridLayout.spec(i, 1f);
            columnSpec = GridLayout.spec(j, 1f);
            GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpec, columnSpec);
            params.rightMargin = getResources().getDimensionPixelSize(R.dimen.space_2);
            params.topMargin = getResources().getDimensionPixelSize(R.dimen.space_2);
            params.setGravity(Gravity.FILL);
            v.setLayoutParams(params);
            parent.addView(v, params);

        }
    }

    private void initAOOIcIds() {
//        aooic_ids[3][0] = R.id.AOOIC_Item_3;
//        aooic_ids[3][1] = R.id.AOOIC_Specical_3;
//        aooic_ids[3][2] = R.id.AOOIC_Price_3;
//        aooic_ids[3][3] = R.id.AOOIC_QtyPcs_3;
//        aooic_ids[3][4] = R.id.AOOIC_Wastage_3;
//        aooic_ids[3][5] = R.id.AOOIC_Mincost_3;
//        aooic_ids[3][6] = R.id.AOOIC_MMCopy_3;
//        aooic_ids[3][7] = R.id.AOOIC_KGCopy_3;
//        aooic_ids[3][8] = R.id.AOOIC_TotalCost_3;
//        aooic_ids[3][9] = R.id.AOOIC_UnitCost_3;
//        aooic_ids[3][10] = R.id.AOOIC_Remake_3;
//
//        aooic_ids[4][0] = R.id.AOOIC_Item_4;
//        aooic_ids[4][1] = R.id.AOOIC_Specical_4;
//        aooic_ids[4][2] = R.id.AOOIC_Price_4;
//        aooic_ids[4][3] = R.id.AOOIC_QtyPcs_4;
//        aooic_ids[4][4] = R.id.AOOIC_Wastage_4;
//        aooic_ids[4][5] = R.id.AOOIC_Mincost_4;
//        aooic_ids[4][6] = R.id.AOOIC_MMCopy_4;
//        aooic_ids[4][7] = R.id.AOOIC_KGCopy_4;
//        aooic_ids[4][8] = R.id.AOOIC_TotalCost_4;
//        aooic_ids[4][9] = R.id.AOOIC_UnitCost_4;
//        aooic_ids[4][10] = R.id.AOOIC_Remake_4;
//
//        aooic_ids[5][0] = R.id.AOOIC_Item_5;
//        aooic_ids[5][1] = R.id.AOOIC_Specical_5;
//        aooic_ids[5][2] = R.id.AOOIC_Price_5;
//        aooic_ids[5][3] = R.id.AOOIC_QtyPcs_5;
//        aooic_ids[5][4] = R.id.AOOIC_Wastage_5;
//        aooic_ids[5][5] = R.id.AOOIC_Mincost_5;
//        aooic_ids[5][6] = R.id.AOOIC_MMCopy_5;
//        aooic_ids[5][7] = R.id.AOOIC_KGCopy_5;
//        aooic_ids[5][8] = R.id.AOOIC_TotalCost_5;
//        aooic_ids[5][9] = R.id.AOOIC_UnitCost_5;
//        aooic_ids[5][10] = R.id.AOOIC_Remake_5;
//
//        aooic_ids[6][0] = R.id.AOOIC_Item_6;
//        aooic_ids[6][1] = R.id.AOOIC_Specical_6;
//        aooic_ids[6][2] = R.id.AOOIC_Price_6;
//        aooic_ids[6][3] = R.id.AOOIC_QtyPcs_6;
//        aooic_ids[6][4] = R.id.AOOIC_Wastage_6;
//        aooic_ids[6][5] = R.id.AOOIC_Mincost_6;
//        aooic_ids[6][6] = R.id.AOOIC_MMCopy_6;
//        aooic_ids[6][7] = R.id.AOOIC_KGCopy_6;
//        aooic_ids[6][8] = R.id.AOOIC_TotalCost_6;
//        aooic_ids[6][9] = R.id.AOOIC_UnitCost_6;
//        aooic_ids[6][10] = R.id.AOOIC_Remake_6;
//
//        aooic_ids[7][0] = R.id.AOOIC_Item_7;
//        aooic_ids[7][1] = R.id.AOOIC_Specical_7;
//        aooic_ids[7][2] = R.id.AOOIC_Price_7;
//        aooic_ids[7][3] = R.id.AOOIC_QtyPcs_7;
//        aooic_ids[7][4] = R.id.AOOIC_Wastage_7;
//        aooic_ids[7][5] = R.id.AOOIC_Mincost_7;
//        aooic_ids[7][6] = R.id.AOOIC_MMCopy_7;
//        aooic_ids[7][7] = R.id.AOOIC_KGCopy_7;
//        aooic_ids[7][8] = R.id.AOOIC_TotalCost_7;
//        aooic_ids[7][9] = R.id.AOOIC_UnitCost_7;
//        aooic_ids[7][10] = R.id.AOOIC_Remake_7;
//
//        aooic_ids[8][0] = R.id.AOOIC_Item_8;
//        aooic_ids[8][1] = R.id.AOOIC_Specical_8;
//        aooic_ids[8][2] = R.id.AOOIC_Price_8;
//        aooic_ids[8][3] = R.id.AOOIC_QtyPcs_8;
//        aooic_ids[8][4] = R.id.AOOIC_Wastage_8;
//        aooic_ids[8][5] = R.id.AOOIC_Mincost_8;
//        aooic_ids[8][6] = R.id.AOOIC_MMCopy_8;
//        aooic_ids[8][7] = R.id.AOOIC_KGCopy_8;
//        aooic_ids[8][8] = R.id.AOOIC_TotalCost_8;
//        aooic_ids[8][9] = R.id.AOOIC_UnitCost_8;
//        aooic_ids[8][10] = R.id.AOOIC_Remake_8;
//
//        aooic_ids[9][0] = R.id.AOOIC_Item_9;
//        aooic_ids[9][1] = R.id.AOOIC_Specical_9;
//        aooic_ids[9][2] = R.id.AOOIC_Price_9;
//        aooic_ids[9][3] = R.id.AOOIC_QtyPcs_9;
//        aooic_ids[9][4] = R.id.AOOIC_Wastage_9;
//        aooic_ids[9][5] = R.id.AOOIC_Mincost_9;
//        aooic_ids[9][6] = R.id.AOOIC_MMCopy_9;
//        aooic_ids[9][7] = R.id.AOOIC_KGCopy_9;
//        aooic_ids[9][8] = R.id.AOOIC_TotalCost_9;
//        aooic_ids[9][9] = R.id.AOOIC_UnitCost_9;
//        aooic_ids[9][10] = R.id.AOOIC_Remake_9;
//
//        aooic_ids[10][0] = R.id.AOOIC_Item_10;
//        aooic_ids[10][1] = R.id.AOOIC_Specical_10;
//        aooic_ids[10][2] = R.id.AOOIC_Price_10;
//        aooic_ids[10][3] = R.id.AOOIC_QtyPcs_10;
//        aooic_ids[10][4] = R.id.AOOIC_Wastage_10;
//        aooic_ids[10][5] = R.id.AOOIC_Mincost_10;
//        aooic_ids[10][6] = R.id.AOOIC_MMCopy_10;
//        aooic_ids[10][7] = R.id.AOOIC_KGCopy_10;
//        aooic_ids[10][8] = R.id.AOOIC_TotalCost_10;
//        aooic_ids[10][9] = R.id.AOOIC_UnitCost_10;
//        aooic_ids[10][10] = R.id.AOOIC_Remake_10;
    }

    void initPrintIds() {

//
//        print_ids[3][0] = R.id.print_item_3;
//        print_ids[3][1] = R.id.print_groupName_3;
//        print_ids[3][2] = R.id.print_cmkyfontNumb_3;
//        print_ids[3][3] = R.id.print_cmkybackNumb_3;
//        print_ids[3][4] = R.id.print_pmsfontNumb_3;
//        print_ids[3][5] = R.id.print_pmsbackNumb_3;
//        print_ids[3][6] = R.id.print_MVfontNumb_3;
//        print_ids[3][7] = R.id.print_MVfontType_3;
//        print_ids[3][8] = R.id.print_MVbackNumb_3;
//        print_ids[3][9] = R.id.print_MVbackType_3;
//        print_ids[3][10] = R.id.print_SDfontNumb_3;
//        print_ids[3][11] = R.id.print_SDfontType_3;
//        print_ids[3][12] = R.id.print_SDbackNumb_3;
//        print_ids[3][13] = R.id.print_SDbackType_3;
//        print_ids[3][14] = R.id.print_SDturnType_3;
//        print_ids[3][15] = R.id.print_PaperBoard_3;
//        print_ids[3][16] = R.id.print_sheet_3;
//        print_ids[3][17] = R.id.print_rateA_3;
//        print_ids[3][18] = R.id.print_rate_3;
//        print_ids[3][19] = R.id.print_mincostA_3;
//        print_ids[3][20] = R.id.print_mincost_3;
//        print_ids[3][21] = R.id.print_totalcost_3;
//        print_ids[3][22] = R.id.print_unitcost_3;
//        print_ids[3][23] = R.id.print_remain_3;
//
//        print_ids[4][0] = R.id.print_item_4;
//        print_ids[4][1] = R.id.print_groupName_4;
//        print_ids[4][2] = R.id.print_cmkyfontNumb_4;
//        print_ids[4][3] = R.id.print_cmkybackNumb_4;
//        print_ids[4][4] = R.id.print_pmsfontNumb_4;
//        print_ids[4][5] = R.id.print_pmsbackNumb_4;
//        print_ids[4][6] = R.id.print_MVfontNumb_4;
//        print_ids[4][7] = R.id.print_MVfontType_4;
//        print_ids[4][8] = R.id.print_MVbackNumb_4;
//        print_ids[4][9] = R.id.print_MVbackType_4;
//        print_ids[4][10] = R.id.print_SDfontNumb_4;
//        print_ids[4][11] = R.id.print_SDfontType_4;
//        print_ids[4][12] = R.id.print_SDbackNumb_4;
//        print_ids[4][13] = R.id.print_SDbackType_4;
//        print_ids[4][14] = R.id.print_SDturnType_4;
//        print_ids[4][15] = R.id.print_PaperBoard_4;
//        print_ids[4][16] = R.id.print_sheet_4;
//        print_ids[4][17] = R.id.print_rateA_4;
//        print_ids[4][18] = R.id.print_rate_4;
//        print_ids[4][19] = R.id.print_mincostA_4;
//        print_ids[4][20] = R.id.print_mincost_4;
//        print_ids[4][21] = R.id.print_totalcost_4;
//        print_ids[4][22] = R.id.print_unitcost_4;
//        print_ids[4][23] = R.id.print_remain_4;
//
//        print_ids[5][0] = R.id.print_item_5;
//        print_ids[5][1] = R.id.print_groupName_5;
//        print_ids[5][2] = R.id.print_cmkyfontNumb_5;
//        print_ids[5][3] = R.id.print_cmkybackNumb_5;
//        print_ids[5][4] = R.id.print_pmsfontNumb_5;
//        print_ids[5][5] = R.id.print_pmsbackNumb_5;
//        print_ids[5][6] = R.id.print_MVfontNumb_5;
//        print_ids[5][7] = R.id.print_MVfontType_5;
//        print_ids[5][8] = R.id.print_MVbackNumb_5;
//        print_ids[5][9] = R.id.print_MVbackType_5;
//        print_ids[5][10] = R.id.print_SDfontNumb_5;
//        print_ids[5][11] = R.id.print_SDfontType_5;
//        print_ids[5][12] = R.id.print_SDbackNumb_5;
//        print_ids[5][13] = R.id.print_SDbackType_5;
//        print_ids[5][14] = R.id.print_SDturnType_5;
//        print_ids[5][15] = R.id.print_PaperBoard_5;
//        print_ids[5][16] = R.id.print_sheet_5;
//        print_ids[5][17] = R.id.print_rateA_5;
//        print_ids[5][18] = R.id.print_rate_5;
//        print_ids[5][19] = R.id.print_mincostA_5;
//        print_ids[5][20] = R.id.print_mincost_5;
//        print_ids[5][21] = R.id.print_totalcost_5;
//        print_ids[5][22] = R.id.print_unitcost_5;
//        print_ids[5][23] = R.id.print_remain_5;
//
//        print_ids[6][0] = R.id.print_item_6;
//        print_ids[6][1] = R.id.print_groupName_6;
//        print_ids[6][2] = R.id.print_cmkyfontNumb_6;
//        print_ids[6][3] = R.id.print_cmkybackNumb_6;
//        print_ids[6][4] = R.id.print_pmsfontNumb_6;
//        print_ids[6][5] = R.id.print_pmsbackNumb_6;
//        print_ids[6][6] = R.id.print_MVfontNumb_6;
//        print_ids[6][7] = R.id.print_MVfontType_6;
//        print_ids[6][8] = R.id.print_MVbackNumb_6;
//        print_ids[6][9] = R.id.print_MVbackType_6;
//        print_ids[6][10] = R.id.print_SDfontNumb_6;
//        print_ids[6][11] = R.id.print_SDfontType_6;
//        print_ids[6][12] = R.id.print_SDbackNumb_6;
//        print_ids[6][13] = R.id.print_SDbackType_6;
//        print_ids[6][14] = R.id.print_SDturnType_6;
//        print_ids[6][15] = R.id.print_PaperBoard_6;
//        print_ids[6][16] = R.id.print_sheet_6;
//        print_ids[6][17] = R.id.print_rateA_6;
//        print_ids[6][18] = R.id.print_rate_6;
//        print_ids[6][19] = R.id.print_mincostA_6;
//        print_ids[6][20] = R.id.print_mincost_6;
//        print_ids[6][21] = R.id.print_totalcost_6;
//        print_ids[6][22] = R.id.print_unitcost_6;
//        print_ids[6][23] = R.id.print_remain_6;
//
//        print_ids[7][0] = R.id.print_item_7;
//        print_ids[7][1] = R.id.print_groupName_7;
//        print_ids[7][2] = R.id.print_cmkyfontNumb_7;
//        print_ids[7][3] = R.id.print_cmkybackNumb_7;
//        print_ids[7][4] = R.id.print_pmsfontNumb_7;
//        print_ids[7][5] = R.id.print_pmsbackNumb_7;
//        print_ids[7][6] = R.id.print_MVfontNumb_7;
//        print_ids[7][7] = R.id.print_MVfontType_7;
//        print_ids[7][8] = R.id.print_MVbackNumb_7;
//        print_ids[7][9] = R.id.print_MVbackType_7;
//        print_ids[7][10] = R.id.print_SDfontNumb_7;
//        print_ids[7][11] = R.id.print_SDfontType_7;
//        print_ids[7][12] = R.id.print_SDbackNumb_7;
//        print_ids[7][13] = R.id.print_SDbackType_7;
//        print_ids[7][14] = R.id.print_SDturnType_7;
//        print_ids[7][15] = R.id.print_PaperBoard_7;
//        print_ids[7][16] = R.id.print_sheet_7;
//        print_ids[7][17] = R.id.print_rateA_7;
//        print_ids[7][18] = R.id.print_rate_7;
//        print_ids[7][19] = R.id.print_mincostA_7;
//        print_ids[7][20] = R.id.print_mincost_7;
//        print_ids[7][21] = R.id.print_totalcost_7;
//        print_ids[7][22] = R.id.print_unitcost_7;
//        print_ids[7][23] = R.id.print_remain_7;
//
//        print_ids[8][0] = R.id.print_item_8;
//        print_ids[8][1] = R.id.print_groupName_8;
//        print_ids[8][2] = R.id.print_cmkyfontNumb_8;
//        print_ids[8][3] = R.id.print_cmkybackNumb_8;
//        print_ids[8][4] = R.id.print_pmsfontNumb_8;
//        print_ids[8][5] = R.id.print_pmsbackNumb_8;
//        print_ids[8][6] = R.id.print_MVfontNumb_8;
//        print_ids[8][7] = R.id.print_MVfontType_8;
//        print_ids[8][8] = R.id.print_MVbackNumb_8;
//        print_ids[8][9] = R.id.print_MVbackType_8;
//        print_ids[8][10] = R.id.print_SDfontNumb_8;
//        print_ids[8][11] = R.id.print_SDfontType_8;
//        print_ids[8][12] = R.id.print_SDbackNumb_8;
//        print_ids[8][13] = R.id.print_SDbackType_8;
//        print_ids[8][14] = R.id.print_SDturnType_8;
//        print_ids[8][15] = R.id.print_PaperBoard_8;
//        print_ids[8][16] = R.id.print_sheet_8;
//        print_ids[8][17] = R.id.print_rateA_8;
//        print_ids[8][18] = R.id.print_rate_8;
//        print_ids[8][19] = R.id.print_mincostA_8;
//        print_ids[8][20] = R.id.print_mincost_8;
//        print_ids[8][21] = R.id.print_totalcost_8;
//        print_ids[8][22] = R.id.print_unitcost_8;
//        print_ids[8][23] = R.id.print_remain_8;
//
//        print_ids[9][0] = R.id.print_item_9;
//        print_ids[9][1] = R.id.print_groupName_9;
//        print_ids[9][2] = R.id.print_cmkyfontNumb_9;
//        print_ids[9][3] = R.id.print_cmkybackNumb_9;
//        print_ids[9][4] = R.id.print_pmsfontNumb_9;
//        print_ids[9][5] = R.id.print_pmsbackNumb_9;
//        print_ids[9][6] = R.id.print_MVfontNumb_9;
//        print_ids[9][7] = R.id.print_MVfontType_9;
//        print_ids[9][8] = R.id.print_MVbackNumb_9;
//        print_ids[9][9] = R.id.print_MVbackType_9;
//        print_ids[9][10] = R.id.print_SDfontNumb_9;
//        print_ids[9][11] = R.id.print_SDfontType_9;
//        print_ids[9][12] = R.id.print_SDbackNumb_9;
//        print_ids[9][13] = R.id.print_SDbackType_9;
//        print_ids[9][14] = R.id.print_SDturnType_9;
//        print_ids[9][15] = R.id.print_PaperBoard_9;
//        print_ids[9][16] = R.id.print_sheet_9;
//        print_ids[9][17] = R.id.print_rateA_9;
//        print_ids[9][18] = R.id.print_rate_9;
//        print_ids[9][19] = R.id.print_mincostA_9;
//        print_ids[9][20] = R.id.print_mincost_9;
//        print_ids[9][21] = R.id.print_totalcost_9;
//        print_ids[9][22] = R.id.print_unitcost_9;
//        print_ids[9][23] = R.id.print_remain_9;
//
//        print_ids[10][0] = R.id.print_item_10;
//        print_ids[10][1] = R.id.print_groupName_10;
//        print_ids[10][2] = R.id.print_cmkyfontNumb_10;
//        print_ids[10][3] = R.id.print_cmkybackNumb_10;
//        print_ids[10][4] = R.id.print_pmsfontNumb_10;
//        print_ids[10][5] = R.id.print_pmsbackNumb_10;
//        print_ids[10][6] = R.id.print_MVfontNumb_10;
//        print_ids[10][7] = R.id.print_MVfontType_10;
//        print_ids[10][8] = R.id.print_MVbackNumb_10;
//        print_ids[10][9] = R.id.print_MVbackType_10;
//        print_ids[10][10] = R.id.print_SDfontNumb_10;
//        print_ids[10][11] = R.id.print_SDfontType_10;
//        print_ids[10][12] = R.id.print_SDbackNumb_10;
//        print_ids[10][13] = R.id.print_SDbackType_10;
//        print_ids[10][14] = R.id.print_SDturnType_10;
//        print_ids[10][15] = R.id.print_PaperBoard_10;
//        print_ids[10][16] = R.id.print_sheet_10;
//        print_ids[10][17] = R.id.print_rateA_10;
//        print_ids[10][18] = R.id.print_rate_10;
//        print_ids[10][19] = R.id.print_mincostA_10;
//        print_ids[10][20] = R.id.print_mincost_10;
//        print_ids[10][21] = R.id.print_totalcost_10;
//        print_ids[10][22] = R.id.print_unitcost_10;
//        print_ids[10][23] = R.id.print_remain_10;
    }

    void initIds() {


//        ids[3][0] = R.id.item_3;
//        ids[3][1] = R.id.groupName_3;
//        ids[3][2] = R.id.tpsNumb_3;
//        ids[3][3] = R.id.tpsUnit_3;
//        ids[3][4] = R.id.tpslength_3;
//        ids[3][5] = R.id.tpswidth_3;
//        ids[3][6] = R.id.LayoutNumb_3;
//        ids[3][7] = R.id.LayoutLength_3;
//        ids[3][8] = R.id.LayoutWidth_3;
//        ids[3][9] = R.id.LayoutUps_3;
//        ids[3][10] = R.id.Paper_Length_3;
//        ids[3][11] = R.id.PaperWidth_3;
//        ids[3][12] = R.id.PaperGsm_3;
//        ids[3][13] = R.id.PaperTypeNumb_3;
//        ids[3][14] = R.id.PaperTypeName_3;
//        ids[3][15] = R.id.PaperMoneyType_3;
//        ids[3][16] = R.id.PaperDgsm_3;
//        ids[3][17] = R.id.PaperDReam_3;
//        ids[3][18] = R.id.PaperSet_3;
//        ids[3][19] = R.id.Leaf_3;
//        ids[3][20] = R.id.WastFPPlate_3;
//        ids[3][21] = R.id.TotalReam_3;
//        ids[3][22] = R.id.mmCopy_3;
//        ids[3][23] = R.id.kgCopy3;
//        ids[3][24] = R.id.totalWegt3;
//        ids[3][25] = R.id.TotalCost3;
//        ids[3][26] = R.id.PaperMoneyRate_3;
//        ids[3][27] = R.id.UnitCost3;
//
//        ids[4][0] = R.id.item_4;
//        ids[4][1] = R.id.groupName_4;
//        ids[4][2] = R.id.tpsNumb_4;
//        ids[4][3] = R.id.tpsUnit_4;
//        ids[4][4] = R.id.tpslength_4;
//        ids[4][5] = R.id.tpswidth_4;
//        ids[4][6] = R.id.LayoutNumb_4;
//        ids[4][7] = R.id.LayoutLength_4;
//        ids[4][8] = R.id.LayoutWidth_4;
//        ids[4][9] = R.id.LayoutUps_4;
//        ids[4][10] = R.id.Paper_Length_4;
//        ids[4][11] = R.id.PaperWidth_4;
//        ids[4][12] = R.id.PaperGsm_4;
//        ids[4][13] = R.id.PaperTypeNumb_4;
//        ids[4][14] = R.id.PaperTypeName_4;
//        ids[4][15] = R.id.PaperMoneyType_4;
//        ids[4][16] = R.id.PaperDgsm_4;
//        ids[4][17] = R.id.PaperDReam_4;
//        ids[4][18] = R.id.PaperSet_4;
//        ids[4][19] = R.id.Leaf_4;
//        ids[4][20] = R.id.WastFPPlate_4;
//        ids[4][21] = R.id.TotalReam_4;
//        ids[4][22] = R.id.mmCopy_4;
//        ids[4][23] = R.id.kgCopy4;
//        ids[4][24] = R.id.totalWegt4;
//        ids[4][25] = R.id.TotalCost4;
//        ids[4][26] = R.id.PaperMoneyRate_4;
//        ids[4][27] = R.id.UnitCost4;
//
//        ids[5][0] = R.id.item_5;
//        ids[5][1] = R.id.groupName_5;
//        ids[5][2] = R.id.tpsNumb_5;
//        ids[5][3] = R.id.tpsUnit_5;
//        ids[5][4] = R.id.tpslength_5;
//        ids[5][5] = R.id.tpswidth_5;
//        ids[5][6] = R.id.LayoutNumb_5;
//        ids[5][7] = R.id.LayoutLength_5;
//        ids[5][8] = R.id.LayoutWidth_5;
//        ids[5][9] = R.id.LayoutUps_5;
//        ids[5][10] = R.id.Paper_Length_5;
//        ids[5][11] = R.id.PaperWidth_5;
//        ids[5][12] = R.id.PaperGsm_5;
//        ids[5][13] = R.id.PaperTypeNumb_5;
//        ids[5][14] = R.id.PaperTypeName_5;
//        ids[5][15] = R.id.PaperMoneyType_5;
//        ids[5][16] = R.id.PaperDgsm_5;
//        ids[5][17] = R.id.PaperDReam_5;
//        ids[5][18] = R.id.PaperSet_5;
//        ids[5][19] = R.id.Leaf_5;
//        ids[5][20] = R.id.WastFPPlate_5;
//        ids[5][21] = R.id.TotalReam_5;
//        ids[5][22] = R.id.mmCopy_5;
//        ids[5][23] = R.id.kgCopy5;
//        ids[5][24] = R.id.totalWegt5;
//        ids[5][25] = R.id.TotalCost5;
//        ids[5][26] = R.id.PaperMoneyRate_5;
//        ids[5][27] = R.id.UnitCost5;
//
//        ids[6][0] = R.id.item_6;
//        ids[6][1] = R.id.groupName_6;
//        ids[6][2] = R.id.tpsNumb_6;
//        ids[6][3] = R.id.tpsUnit_6;
//        ids[6][4] = R.id.tpslength_6;
//        ids[6][5] = R.id.tpswidth_6;
//        ids[6][6] = R.id.LayoutNumb_6;
//        ids[6][7] = R.id.LayoutLength_6;
//        ids[6][8] = R.id.LayoutWidth_6;
//        ids[6][9] = R.id.LayoutUps_6;
//        ids[6][10] = R.id.Paper_Length_6;
//        ids[6][11] = R.id.PaperWidth_6;
//        ids[6][12] = R.id.PaperGsm_6;
//        ids[6][13] = R.id.PaperTypeNumb_6;
//        ids[6][14] = R.id.PaperTypeName_6;
//        ids[6][15] = R.id.PaperMoneyType_6;
//        ids[6][16] = R.id.PaperDgsm_6;
//        ids[6][17] = R.id.PaperDReam_6;
//        ids[6][18] = R.id.PaperSet_6;
//        ids[6][19] = R.id.Leaf_6;
//        ids[6][20] = R.id.WastFPPlate_6;
//        ids[6][21] = R.id.TotalReam_6;
//        ids[6][22] = R.id.mmCopy_6;
//        ids[6][23] = R.id.kgCopy6;
//        ids[6][24] = R.id.totalWegt6;
//        ids[6][25] = R.id.TotalCost6;
//        ids[6][26] = R.id.PaperMoneyRate_6;
//        ids[6][27] = R.id.UnitCost6;
//
//        ids[7][0] = R.id.item_7;
//        ids[7][1] = R.id.groupName_7;
//        ids[7][2] = R.id.tpsNumb_7;
//        ids[7][3] = R.id.tpsUnit_7;
//        ids[7][4] = R.id.tpslength_7;
//        ids[7][5] = R.id.tpswidth_7;
//        ids[7][6] = R.id.LayoutNumb_7;
//        ids[7][7] = R.id.LayoutLength_7;
//        ids[7][8] = R.id.LayoutWidth_7;
//        ids[7][9] = R.id.LayoutUps_7;
//        ids[7][10] = R.id.Paper_Length_7;
//        ids[7][11] = R.id.PaperWidth_7;
//        ids[7][12] = R.id.PaperGsm_7;
//        ids[7][13] = R.id.PaperTypeNumb_7;
//        ids[7][14] = R.id.PaperTypeName_7;
//        ids[7][15] = R.id.PaperMoneyType_7;
//        ids[7][16] = R.id.PaperDgsm_7;
//        ids[7][17] = R.id.PaperDReam_7;
//        ids[7][18] = R.id.PaperSet_7;
//        ids[7][19] = R.id.Leaf_7;
//        ids[7][20] = R.id.WastFPPlate_7;
//        ids[7][21] = R.id.TotalReam_7;
//        ids[7][22] = R.id.mmCopy_7;
//        ids[7][23] = R.id.kgCopy7;
//        ids[7][24] = R.id.totalWegt7;
//        ids[7][25] = R.id.TotalCost7;
//        ids[7][26] = R.id.PaperMoneyRate_7;
//        ids[7][27] = R.id.UnitCost7;
//
//        ids[8][0] = R.id.item_8;
//        ids[8][1] = R.id.groupName_8;
//        ids[8][2] = R.id.tpsNumb_8;
//        ids[8][3] = R.id.tpsUnit_8;
//        ids[8][4] = R.id.tpslength_8;
//        ids[8][5] = R.id.tpswidth_8;
//        ids[8][6] = R.id.LayoutNumb_8;
//        ids[8][7] = R.id.LayoutLength_8;
//        ids[8][8] = R.id.LayoutWidth_8;
//        ids[8][9] = R.id.LayoutUps_8;
//        ids[8][10] = R.id.Paper_Length_8;
//        ids[8][11] = R.id.PaperWidth_8;
//        ids[8][12] = R.id.PaperGsm_8;
//        ids[8][13] = R.id.PaperTypeNumb_8;
//        ids[8][14] = R.id.PaperTypeName_8;
//        ids[8][15] = R.id.PaperMoneyType_8;
//        ids[8][16] = R.id.PaperDgsm_8;
//        ids[8][17] = R.id.PaperDReam_8;
//        ids[8][18] = R.id.PaperSet_8;
//        ids[8][19] = R.id.Leaf_8;
//        ids[8][20] = R.id.WastFPPlate_8;
//        ids[8][21] = R.id.TotalReam_8;
//        ids[8][22] = R.id.mmCopy_8;
//        ids[8][23] = R.id.kgCopy8;
//        ids[8][24] = R.id.totalWegt8;
//        ids[8][25] = R.id.TotalCost8;
//        ids[8][26] = R.id.PaperMoneyRate_8;
//        ids[8][27] = R.id.UnitCost8;
//
//        ids[9][0] = R.id.item_9;
//        ids[9][1] = R.id.groupName_9;
//        ids[9][2] = R.id.tpsNumb_9;
//        ids[9][3] = R.id.tpsUnit_9;
//        ids[9][4] = R.id.tpslength_9;
//        ids[9][5] = R.id.tpswidth_9;
//        ids[9][6] = R.id.LayoutNumb_9;
//        ids[9][7] = R.id.LayoutLength_9;
//        ids[9][8] = R.id.LayoutWidth_9;
//        ids[9][9] = R.id.LayoutUps_9;
//        ids[9][10] = R.id.Paper_Length_9;
//        ids[9][11] = R.id.PaperWidth_9;
//        ids[9][12] = R.id.PaperGsm_9;
//        ids[9][13] = R.id.PaperTypeNumb_9;
//        ids[9][14] = R.id.PaperTypeName_9;
//        ids[9][15] = R.id.PaperMoneyType_9;
//        ids[9][16] = R.id.PaperDgsm_9;
//        ids[9][17] = R.id.PaperDReam_9;
//        ids[9][18] = R.id.PaperSet_9;
//        ids[9][19] = R.id.Leaf_9;
//        ids[9][20] = R.id.WastFPPlate_9;
//        ids[9][21] = R.id.TotalReam_9;
//        ids[9][22] = R.id.mmCopy_9;
//        ids[9][23] = R.id.kgCopy9;
//        ids[9][24] = R.id.totalWegt9;
//        ids[9][25] = R.id.TotalCost9;
//        ids[9][26] = R.id.PaperMoneyRate_9;
//        ids[9][27] = R.id.UnitCost9;
//
//        ids[10][0] = R.id.item_10;
//        ids[10][1] = R.id.groupName_10;
//        ids[10][2] = R.id.tpsNumb_10;
//        ids[10][3] = R.id.tpsUnit_10;
//        ids[10][4] = R.id.tpslength_10;
//        ids[10][5] = R.id.tpswidth_10;
//        ids[10][6] = R.id.LayoutNumb_10;
//        ids[10][7] = R.id.LayoutLength_10;
//        ids[10][8] = R.id.LayoutWidth_10;
//        ids[10][9] = R.id.LayoutUps_10;
//        ids[10][10] = R.id.Paper_Length_10;
//        ids[10][11] = R.id.PaperWidth_10;
//        ids[10][12] = R.id.PaperGsm_10;
//        ids[10][13] = R.id.PaperTypeNumb_10;
//        ids[10][14] = R.id.PaperTypeName_10;
//        ids[10][15] = R.id.PaperMoneyType_10;
//        ids[10][16] = R.id.PaperDgsm_10;
//        ids[10][17] = R.id.PaperDReam_10;
//        ids[10][18] = R.id.PaperSet_10;
//        ids[10][19] = R.id.Leaf_10;
//        ids[10][20] = R.id.WastFPPlate_10;
//        ids[10][21] = R.id.TotalReam_10;
//        ids[10][22] = R.id.mmCopy_10;
//        ids[10][23] = R.id.kgCopy10;
//        ids[10][24] = R.id.totalWegt10;
//        ids[10][25] = R.id.TotalCost10;
//        ids[10][26] = R.id.PaperMoneyRate_10;
//        ids[10][27] = R.id.UnitCost10;
    }

    private void initProgressIds() {


//        process_ids[3][0] = R.id.process_item_3;
//        process_ids[3][1] = R.id.process_groupName_3;
//        process_ids[3][2] = R.id.process_KindsType_3;
//        process_ids[3][3] = R.id.process_Kinds_3;
//        process_ids[3][4] = R.id.process_A_3;
//        process_ids[3][5] = R.id.process_B_3;
//        process_ids[3][6] = R.id.process_Dplate_3;
//        process_ids[3][7] = R.id.process_PlateSet_3;
//        process_ids[3][8] = R.id.process_PlateQty_3;
//        process_ids[3][9] = R.id.process_MinCost_3;
//        process_ids[3][10] = R.id.process_ExtraPCXT_3;
//        process_ids[3][11] = R.id.process_UnitCost_3;
//        process_ids[3][12] = R.id.process_ToalCost_3;
//
//        process_ids[4][0] = R.id.process_item_4;
//        process_ids[4][1] = R.id.process_groupName_4;
//        process_ids[4][2] = R.id.process_KindsType_4;
//        process_ids[4][3] = R.id.process_Kinds_4;
//        process_ids[4][4] = R.id.process_A_4;
//        process_ids[4][5] = R.id.process_B_4;
//        process_ids[4][6] = R.id.process_Dplate_4;
//        process_ids[4][7] = R.id.process_PlateSet_4;
//        process_ids[4][8] = R.id.process_PlateQty_4;
//        process_ids[4][9] = R.id.process_MinCost_4;
//        process_ids[4][10] = R.id.process_ExtraPCXT_4;
//        process_ids[4][11] = R.id.process_UnitCost_4;
//        process_ids[4][12] = R.id.process_ToalCost_4;
//
//        process_ids[5][0] = R.id.process_item_5;
//        process_ids[5][1] = R.id.process_groupName_5;
//        process_ids[5][2] = R.id.process_KindsType_5;
//        process_ids[5][3] = R.id.process_Kinds_5;
//        process_ids[5][4] = R.id.process_A_5;
//        process_ids[5][5] = R.id.process_B_5;
//        process_ids[5][6] = R.id.process_Dplate_5;
//        process_ids[5][7] = R.id.process_PlateSet_5;
//        process_ids[5][8] = R.id.process_PlateQty_5;
//        process_ids[5][9] = R.id.process_MinCost_5;
//        process_ids[5][10] = R.id.process_ExtraPCXT_5;
//        process_ids[5][11] = R.id.process_UnitCost_5;
//        process_ids[5][12] = R.id.process_ToalCost_5;
//
//        process_ids[6][0] = R.id.process_item_6;
//        process_ids[6][1] = R.id.process_groupName_6;
//        process_ids[6][2] = R.id.process_KindsType_6;
//        process_ids[6][3] = R.id.process_Kinds_6;
//        process_ids[6][4] = R.id.process_A_6;
//        process_ids[6][5] = R.id.process_B_6;
//        process_ids[6][6] = R.id.process_Dplate_6;
//        process_ids[6][7] = R.id.process_PlateSet_6;
//        process_ids[6][8] = R.id.process_PlateQty_6;
//        process_ids[6][9] = R.id.process_MinCost_6;
//        process_ids[6][10] = R.id.process_ExtraPCXT_6;
//        process_ids[6][11] = R.id.process_UnitCost_6;
//        process_ids[6][12] = R.id.process_ToalCost_6;
//
//        process_ids[7][0] = R.id.process_item_7;
//        process_ids[7][1] = R.id.process_groupName_7;
//        process_ids[7][2] = R.id.process_KindsType_7;
//        process_ids[7][3] = R.id.process_Kinds_7;
//        process_ids[7][4] = R.id.process_A_7;
//        process_ids[7][5] = R.id.process_B_7;
//        process_ids[7][6] = R.id.process_Dplate_7;
//        process_ids[7][7] = R.id.process_PlateSet_7;
//        process_ids[7][8] = R.id.process_PlateQty_7;
//        process_ids[7][9] = R.id.process_MinCost_7;
//        process_ids[7][10] = R.id.process_ExtraPCXT_7;
//        process_ids[7][11] = R.id.process_UnitCost_7;
//        process_ids[7][12] = R.id.process_ToalCost_8;
//
//        process_ids[8][0] = R.id.process_item_8;
//        process_ids[8][1] = R.id.process_groupName_8;
//        process_ids[8][2] = R.id.process_KindsType_8;
//        process_ids[8][3] = R.id.process_Kinds_8;
//        process_ids[8][4] = R.id.process_A_8;
//        process_ids[8][5] = R.id.process_B_8;
//        process_ids[8][6] = R.id.process_Dplate_8;
//        process_ids[8][7] = R.id.process_PlateSet_8;
//        process_ids[8][8] = R.id.process_PlateQty_8;
//        process_ids[8][9] = R.id.process_MinCost_8;
//        process_ids[8][10] = R.id.process_ExtraPCXT_8;
//        process_ids[8][11] = R.id.process_UnitCost_8;
//        process_ids[8][12] = R.id.process_ToalCost_8;
//
//        process_ids[9][0] = R.id.process_item_9;
//        process_ids[9][1] = R.id.process_groupName_9;
//        process_ids[9][2] = R.id.process_KindsType_9;
//        process_ids[9][3] = R.id.process_Kinds_9;
//        process_ids[9][4] = R.id.process_A_9;
//        process_ids[9][5] = R.id.process_B_9;
//        process_ids[9][6] = R.id.process_Dplate_9;
//        process_ids[9][7] = R.id.process_PlateSet_9;
//        process_ids[9][8] = R.id.process_PlateQty_9;
//        process_ids[9][9] = R.id.process_MinCost_9;
//        process_ids[9][10] = R.id.process_ExtraPCXT_9;
//        process_ids[9][11] = R.id.process_UnitCost_9;
//        process_ids[9][12] = R.id.process_ToalCost_9;
//
//        process_ids[10][0] = R.id.process_item_10;
//        process_ids[10][1] = R.id.process_groupName_10;
//        process_ids[10][2] = R.id.process_KindsType_10;
//        process_ids[10][3] = R.id.process_Kinds_10;
//        process_ids[10][4] = R.id.process_A_10;
//        process_ids[10][5] = R.id.process_B_10;
//        process_ids[10][6] = R.id.process_Dplate_10;
//        process_ids[10][7] = R.id.process_PlateSet_10;
//        process_ids[10][8] = R.id.process_PlateQty_10;
//        process_ids[10][9] = R.id.process_MinCost_10;
//        process_ids[10][10] = R.id.process_ExtraPCXT_10;
//        process_ids[10][11] = R.id.process_UnitCost_10;
//        process_ids[10][12] = R.id.process_ToalCost_10;
    }

    private void initProcessDoneIds() {
//        processDone_ids[3][0] = R.id.processDone_item_3;
//        processDone_ids[3][1] = R.id.processDone_groupname_3;
//        processDone_ids[3][2] = R.id.processDone_type_3;
//        processDone_ids[3][3] = R.id.processDone_produceRequest_3;
//        processDone_ids[3][4] = R.id.processDone_side_3;
//        processDone_ids[3][5] = R.id.processDone_Dsheet_3;
//        processDone_ids[3][6] = R.id.processDone_minSheet_3;
//        processDone_ids[3][7] = R.id.processDone_price_3;
//        processDone_ids[3][8] = R.id.processDone_totalQty_3;
//        processDone_ids[3][9] = R.id.processDone_minCost_3;
//        processDone_ids[3][10] = R.id.processDone_TotalCost_3;
//        processDone_ids[3][11] = R.id.processDone_unitCost_3;
//        processDone_ids[3][12] = R.id.processDone_remake_3;
//        processDone_ids[3][13] = R.id.processDone_typeCode_3;
//
//        processDone_ids[4][0] = R.id.processDone_item_4;
//        processDone_ids[4][1] = R.id.processDone_groupname_4;
//        processDone_ids[4][2] = R.id.processDone_type_4;
//        processDone_ids[4][3] = R.id.processDone_produceRequest_4;
//        processDone_ids[4][4] = R.id.processDone_side_4;
//        processDone_ids[4][5] = R.id.processDone_Dsheet_4;
//        processDone_ids[4][6] = R.id.processDone_minSheet_4;
//        processDone_ids[4][7] = R.id.processDone_price_4;
//        processDone_ids[4][8] = R.id.processDone_totalQty_4;
//        processDone_ids[4][9] = R.id.processDone_minCost_4;
//        processDone_ids[4][10] = R.id.processDone_TotalCost_4;
//        processDone_ids[4][11] = R.id.processDone_unitCost_4;
//        processDone_ids[4][12] = R.id.processDone_remake_4;
//        processDone_ids[4][13] = R.id.processDone_typeCode_4;
//
//        processDone_ids[5][0] = R.id.processDone_item_5;
//        processDone_ids[5][1] = R.id.processDone_groupname_5;
//        processDone_ids[5][2] = R.id.processDone_type_5;
//        processDone_ids[5][3] = R.id.processDone_produceRequest_5;
//        processDone_ids[5][4] = R.id.processDone_side_5;
//        processDone_ids[5][5] = R.id.processDone_Dsheet_5;
//        processDone_ids[5][6] = R.id.processDone_minSheet_5;
//        processDone_ids[5][7] = R.id.processDone_price_5;
//        processDone_ids[5][8] = R.id.processDone_totalQty_5;
//        processDone_ids[5][9] = R.id.processDone_minCost_5;
//        processDone_ids[5][10] = R.id.processDone_TotalCost_5;
//        processDone_ids[5][11] = R.id.processDone_unitCost_5;
//        processDone_ids[5][12] = R.id.processDone_remake_5;
//        processDone_ids[5][13] = R.id.processDone_typeCode_5;
//
//        processDone_ids[6][0] = R.id.processDone_item_6;
//        processDone_ids[6][1] = R.id.processDone_groupname_6;
//        processDone_ids[6][2] = R.id.processDone_type_6;
//        processDone_ids[6][3] = R.id.processDone_produceRequest_6;
//        processDone_ids[6][4] = R.id.processDone_side_6;
//        processDone_ids[6][5] = R.id.processDone_Dsheet_6;
//        processDone_ids[6][6] = R.id.processDone_minSheet_6;
//        processDone_ids[6][7] = R.id.processDone_price_6;
//        processDone_ids[6][8] = R.id.processDone_totalQty_6;
//        processDone_ids[6][9] = R.id.processDone_minCost_6;
//        processDone_ids[6][10] = R.id.processDone_TotalCost_6;
//        processDone_ids[6][11] = R.id.processDone_unitCost_6;
//        processDone_ids[6][12] = R.id.processDone_remake_6;
//        processDone_ids[6][13] = R.id.processDone_typeCode_6;
//
//        processDone_ids[7][0] = R.id.processDone_item_7;
//        processDone_ids[7][1] = R.id.processDone_groupname_7;
//        processDone_ids[7][2] = R.id.processDone_type_7;
//        processDone_ids[7][3] = R.id.processDone_produceRequest_7;
//        processDone_ids[7][4] = R.id.processDone_side_7;
//        processDone_ids[7][5] = R.id.processDone_Dsheet_7;
//        processDone_ids[7][6] = R.id.processDone_minSheet_7;
//        processDone_ids[7][7] = R.id.processDone_price_7;
//        processDone_ids[7][8] = R.id.processDone_totalQty_7;
//        processDone_ids[7][9] = R.id.processDone_minCost_7;
//        processDone_ids[7][10] = R.id.processDone_TotalCost_7;
//        processDone_ids[7][11] = R.id.processDone_unitCost_7;
//        processDone_ids[7][12] = R.id.processDone_remake_7;
//        processDone_ids[7][13] = R.id.processDone_typeCode_7;
//
//        processDone_ids[8][0] = R.id.processDone_item_8;
//        processDone_ids[8][1] = R.id.processDone_groupname_8;
//        processDone_ids[8][2] = R.id.processDone_type_8;
//        processDone_ids[8][3] = R.id.processDone_produceRequest_8;
//        processDone_ids[8][4] = R.id.processDone_side_8;
//        processDone_ids[8][5] = R.id.processDone_Dsheet_8;
//        processDone_ids[8][6] = R.id.processDone_minSheet_8;
//        processDone_ids[8][7] = R.id.processDone_price_8;
//        processDone_ids[8][8] = R.id.processDone_totalQty_8;
//        processDone_ids[8][9] = R.id.processDone_minCost_8;
//        processDone_ids[8][10] = R.id.processDone_TotalCost_8;
//        processDone_ids[8][11] = R.id.processDone_unitCost_8;
//        processDone_ids[8][12] = R.id.processDone_remake_8;
//        processDone_ids[8][13] = R.id.processDone_typeCode_8;
//
//        processDone_ids[9][0] = R.id.processDone_item_9;
//        processDone_ids[9][1] = R.id.processDone_groupname_9;
//        processDone_ids[9][2] = R.id.processDone_type_9;
//        processDone_ids[9][3] = R.id.processDone_produceRequest_9;
//        processDone_ids[9][4] = R.id.processDone_side_9;
//        processDone_ids[9][5] = R.id.processDone_Dsheet_9;
//        processDone_ids[9][6] = R.id.processDone_minSheet_9;
//        processDone_ids[9][7] = R.id.processDone_price_9;
//        processDone_ids[9][8] = R.id.processDone_totalQty_9;
//        processDone_ids[9][9] = R.id.processDone_minCost_9;
//        processDone_ids[9][10] = R.id.processDone_TotalCost_9;
//        processDone_ids[9][11] = R.id.processDone_unitCost_9;
//        processDone_ids[9][12] = R.id.processDone_remake_9;
//        processDone_ids[9][13] = R.id.processDone_typeCode_9;
//
//        processDone_ids[10][0] = R.id.processDone_item_10;
//        processDone_ids[10][1] = R.id.processDone_groupname_10;
//        processDone_ids[10][2] = R.id.processDone_type_10;
//        processDone_ids[10][3] = R.id.processDone_produceRequest_10;
//        processDone_ids[10][4] = R.id.processDone_side_10;
//        processDone_ids[10][5] = R.id.processDone_Dsheet_10;
//        processDone_ids[10][6] = R.id.processDone_minSheet_10;
//        processDone_ids[10][7] = R.id.processDone_price_10;
//        processDone_ids[10][8] = R.id.processDone_totalQty_10;
//        processDone_ids[10][9] = R.id.processDone_minCost_10;
//        processDone_ids[10][10] = R.id.processDone_TotalCost_10;
//        processDone_ids[10][11] = R.id.processDone_unitCost_10;
//        processDone_ids[10][12] = R.id.processDone_remake_10;
//        processDone_ids[10][13] = R.id.processDone_typeCode_10;
    }

    private void initPoceDSecndIds() {
//        poceDSecnd_ids[3][0] = R.id.poceDSecnd_Item_3;
//        poceDSecnd_ids[3][1] = R.id.poceDSecnd_GroupName_3;
//        poceDSecnd_ids[3][2] = R.id.poceDSecnd_Type_3;
//        poceDSecnd_ids[3][3] = R.id.poceDSecnd_PdceRest_3;
//        poceDSecnd_ids[3][4] = R.id.poceDSecnd_UpSheet_3;
//        poceDSecnd_ids[3][5] = R.id.poceDSecnd_Length_3;
//        poceDSecnd_ids[3][6] = R.id.poceDSecnd_Width_3;
//        poceDSecnd_ids[3][7] = R.id.poceDSecnd_DSQ_3;
//        poceDSecnd_ids[3][8] = R.id.poceDSecnd_Times_3;
//        poceDSecnd_ids[3][9] = R.id.poceDSecnd_LabourCost_3;
//        poceDSecnd_ids[3][10] = R.id.poceDSecnd_DSheet_3;
//        poceDSecnd_ids[3][11] = R.id.poceDSecnd_Pcs_3;
//        poceDSecnd_ids[3][12] = R.id.poceDSecnd_AMould_3;
//        poceDSecnd_ids[3][13] = R.id.poceDSecnd_Mould_3;
//        poceDSecnd_ids[3][14] = R.id.poceDSecnd_TotalQty_3;
//        poceDSecnd_ids[3][15] = R.id.poceDSecnd_MinCost_3;
//        poceDSecnd_ids[3][16] = R.id.poceDSecnd_TotalCost_3;
//        poceDSecnd_ids[3][17] = R.id.poceDSecnd_UnitCost_3;
//        poceDSecnd_ids[3][18] = R.id.poceDSecnd_Remake_3;
//        poceDSecnd_ids[3][19] = R.id.poceDSecnd_TypeCode_3;
//
//        poceDSecnd_ids[4][0] = R.id.poceDSecnd_Item_4;
//        poceDSecnd_ids[4][1] = R.id.poceDSecnd_GroupName_4;
//        poceDSecnd_ids[4][2] = R.id.poceDSecnd_Type_4;
//        poceDSecnd_ids[4][3] = R.id.poceDSecnd_PdceRest_4;
//        poceDSecnd_ids[4][4] = R.id.poceDSecnd_UpSheet_4;
//        poceDSecnd_ids[4][5] = R.id.poceDSecnd_Length_4;
//        poceDSecnd_ids[4][6] = R.id.poceDSecnd_Width_4;
//        poceDSecnd_ids[4][7] = R.id.poceDSecnd_DSQ_4;
//        poceDSecnd_ids[4][8] = R.id.poceDSecnd_Times_4;
//        poceDSecnd_ids[4][9] = R.id.poceDSecnd_LabourCost_4;
//        poceDSecnd_ids[4][10] = R.id.poceDSecnd_DSheet_4;
//        poceDSecnd_ids[4][11] = R.id.poceDSecnd_Pcs_4;
//        poceDSecnd_ids[4][12] = R.id.poceDSecnd_AMould_4;
//        poceDSecnd_ids[4][13] = R.id.poceDSecnd_Mould_4;
//        poceDSecnd_ids[4][14] = R.id.poceDSecnd_TotalQty_4;
//        poceDSecnd_ids[4][15] = R.id.poceDSecnd_MinCost_4;
//        poceDSecnd_ids[4][16] = R.id.poceDSecnd_TotalCost_4;
//        poceDSecnd_ids[4][17] = R.id.poceDSecnd_UnitCost_4;
//        poceDSecnd_ids[4][18] = R.id.poceDSecnd_Remake_4;
//        poceDSecnd_ids[4][19] = R.id.poceDSecnd_TypeCode_4;
//
//        poceDSecnd_ids[5][0] = R.id.poceDSecnd_Item_5;
//        poceDSecnd_ids[5][1] = R.id.poceDSecnd_GroupName_5;
//        poceDSecnd_ids[5][2] = R.id.poceDSecnd_Type_5;
//        poceDSecnd_ids[5][3] = R.id.poceDSecnd_PdceRest_5;
//        poceDSecnd_ids[5][4] = R.id.poceDSecnd_UpSheet_5;
//        poceDSecnd_ids[5][5] = R.id.poceDSecnd_Length_5;
//        poceDSecnd_ids[5][6] = R.id.poceDSecnd_Width_5;
//        poceDSecnd_ids[5][7] = R.id.poceDSecnd_DSQ_5;
//        poceDSecnd_ids[5][8] = R.id.poceDSecnd_Times_5;
//        poceDSecnd_ids[5][9] = R.id.poceDSecnd_LabourCost_5;
//        poceDSecnd_ids[5][10] = R.id.poceDSecnd_DSheet_5;
//        poceDSecnd_ids[5][11] = R.id.poceDSecnd_Pcs_5;
//        poceDSecnd_ids[5][12] = R.id.poceDSecnd_AMould_5;
//        poceDSecnd_ids[5][13] = R.id.poceDSecnd_Mould_5;
//        poceDSecnd_ids[5][14] = R.id.poceDSecnd_TotalQty_5;
//        poceDSecnd_ids[5][15] = R.id.poceDSecnd_MinCost_5;
//        poceDSecnd_ids[5][16] = R.id.poceDSecnd_TotalCost_5;
//        poceDSecnd_ids[5][17] = R.id.poceDSecnd_UnitCost_5;
//        poceDSecnd_ids[5][18] = R.id.poceDSecnd_Remake_5;
//        poceDSecnd_ids[5][19] = R.id.poceDSecnd_TypeCode_5;
//
//        poceDSecnd_ids[6][0] = R.id.poceDSecnd_Item_6;
//        poceDSecnd_ids[6][1] = R.id.poceDSecnd_GroupName_6;
//        poceDSecnd_ids[6][2] = R.id.poceDSecnd_Type_6;
//        poceDSecnd_ids[6][3] = R.id.poceDSecnd_PdceRest_6;
//        poceDSecnd_ids[6][4] = R.id.poceDSecnd_UpSheet_6;
//        poceDSecnd_ids[6][5] = R.id.poceDSecnd_Length_6;
//        poceDSecnd_ids[6][6] = R.id.poceDSecnd_Width_6;
//        poceDSecnd_ids[6][7] = R.id.poceDSecnd_DSQ_6;
//        poceDSecnd_ids[6][8] = R.id.poceDSecnd_Times_6;
//        poceDSecnd_ids[6][9] = R.id.poceDSecnd_LabourCost_6;
//        poceDSecnd_ids[6][10] = R.id.poceDSecnd_DSheet_6;
//        poceDSecnd_ids[6][11] = R.id.poceDSecnd_Pcs_6;
//        poceDSecnd_ids[6][12] = R.id.poceDSecnd_AMould_6;
//        poceDSecnd_ids[6][13] = R.id.poceDSecnd_Mould_6;
//        poceDSecnd_ids[6][14] = R.id.poceDSecnd_TotalQty_6;
//        poceDSecnd_ids[6][15] = R.id.poceDSecnd_MinCost_6;
//        poceDSecnd_ids[6][16] = R.id.poceDSecnd_TotalCost_6;
//        poceDSecnd_ids[6][17] = R.id.poceDSecnd_UnitCost_6;
//        poceDSecnd_ids[6][18] = R.id.poceDSecnd_Remake_6;
//        poceDSecnd_ids[6][19] = R.id.poceDSecnd_TypeCode_6;
//
//        poceDSecnd_ids[7][0] = R.id.poceDSecnd_Item_7;
//        poceDSecnd_ids[7][1] = R.id.poceDSecnd_GroupName_7;
//        poceDSecnd_ids[7][2] = R.id.poceDSecnd_Type_7;
//        poceDSecnd_ids[7][3] = R.id.poceDSecnd_PdceRest_7;
//        poceDSecnd_ids[7][4] = R.id.poceDSecnd_UpSheet_7;
//        poceDSecnd_ids[7][5] = R.id.poceDSecnd_Length_7;
//        poceDSecnd_ids[7][6] = R.id.poceDSecnd_Width_7;
//        poceDSecnd_ids[7][7] = R.id.poceDSecnd_DSQ_7;
//        poceDSecnd_ids[7][8] = R.id.poceDSecnd_Times_7;
//        poceDSecnd_ids[7][9] = R.id.poceDSecnd_LabourCost_7;
//        poceDSecnd_ids[7][10] = R.id.poceDSecnd_DSheet_7;
//        poceDSecnd_ids[7][11] = R.id.poceDSecnd_Pcs_7;
//        poceDSecnd_ids[7][12] = R.id.poceDSecnd_AMould_7;
//        poceDSecnd_ids[7][13] = R.id.poceDSecnd_Mould_7;
//        poceDSecnd_ids[7][14] = R.id.poceDSecnd_TotalQty_7;
//        poceDSecnd_ids[7][15] = R.id.poceDSecnd_MinCost_7;
//        poceDSecnd_ids[7][16] = R.id.poceDSecnd_TotalCost_7;
//        poceDSecnd_ids[7][17] = R.id.poceDSecnd_UnitCost_7;
//        poceDSecnd_ids[7][18] = R.id.poceDSecnd_Remake_7;
//        poceDSecnd_ids[7][19] = R.id.poceDSecnd_TypeCode_7;
//
//        poceDSecnd_ids[8][0] = R.id.poceDSecnd_Item_8;
//        poceDSecnd_ids[8][1] = R.id.poceDSecnd_GroupName_8;
//        poceDSecnd_ids[8][2] = R.id.poceDSecnd_Type_8;
//        poceDSecnd_ids[8][3] = R.id.poceDSecnd_PdceRest_8;
//        poceDSecnd_ids[8][4] = R.id.poceDSecnd_UpSheet_8;
//        poceDSecnd_ids[8][5] = R.id.poceDSecnd_Length_8;
//        poceDSecnd_ids[8][6] = R.id.poceDSecnd_Width_8;
//        poceDSecnd_ids[8][7] = R.id.poceDSecnd_DSQ_8;
//        poceDSecnd_ids[8][8] = R.id.poceDSecnd_Times_8;
//        poceDSecnd_ids[8][9] = R.id.poceDSecnd_LabourCost_8;
//        poceDSecnd_ids[8][10] = R.id.poceDSecnd_DSheet_8;
//        poceDSecnd_ids[8][11] = R.id.poceDSecnd_Pcs_8;
//        poceDSecnd_ids[8][12] = R.id.poceDSecnd_AMould_8;
//        poceDSecnd_ids[8][13] = R.id.poceDSecnd_Mould_8;
//        poceDSecnd_ids[8][14] = R.id.poceDSecnd_TotalQty_8;
//        poceDSecnd_ids[8][15] = R.id.poceDSecnd_MinCost_8;
//        poceDSecnd_ids[8][16] = R.id.poceDSecnd_TotalCost_8;
//        poceDSecnd_ids[8][17] = R.id.poceDSecnd_UnitCost_8;
//        poceDSecnd_ids[8][18] = R.id.poceDSecnd_Remake_8;
//        poceDSecnd_ids[8][19] = R.id.poceDSecnd_TypeCode_8;
//
//        poceDSecnd_ids[9][0] = R.id.poceDSecnd_Item_9;
//        poceDSecnd_ids[9][1] = R.id.poceDSecnd_GroupName_9;
//        poceDSecnd_ids[9][2] = R.id.poceDSecnd_Type_9;
//        poceDSecnd_ids[9][3] = R.id.poceDSecnd_PdceRest_9;
//        poceDSecnd_ids[9][4] = R.id.poceDSecnd_UpSheet_9;
//        poceDSecnd_ids[9][5] = R.id.poceDSecnd_Length_9;
//        poceDSecnd_ids[9][6] = R.id.poceDSecnd_Width_9;
//        poceDSecnd_ids[9][7] = R.id.poceDSecnd_DSQ_9;
//        poceDSecnd_ids[9][8] = R.id.poceDSecnd_Times_9;
//        poceDSecnd_ids[9][9] = R.id.poceDSecnd_LabourCost_9;
//        poceDSecnd_ids[9][10] = R.id.poceDSecnd_DSheet_9;
//        poceDSecnd_ids[9][11] = R.id.poceDSecnd_Pcs_9;
//        poceDSecnd_ids[9][12] = R.id.poceDSecnd_AMould_9;
//        poceDSecnd_ids[9][13] = R.id.poceDSecnd_Mould_9;
//        poceDSecnd_ids[9][14] = R.id.poceDSecnd_TotalQty_9;
//        poceDSecnd_ids[9][15] = R.id.poceDSecnd_MinCost_9;
//        poceDSecnd_ids[9][16] = R.id.poceDSecnd_TotalCost_9;
//        poceDSecnd_ids[9][17] = R.id.poceDSecnd_UnitCost_9;
//        poceDSecnd_ids[9][18] = R.id.poceDSecnd_Remake_9;
//        poceDSecnd_ids[9][19] = R.id.poceDSecnd_TypeCode_9;
//
//        poceDSecnd_ids[10][0] = R.id.poceDSecnd_Item_10;
//        poceDSecnd_ids[10][1] = R.id.poceDSecnd_GroupName_10;
//        poceDSecnd_ids[10][2] = R.id.poceDSecnd_Type_10;
//        poceDSecnd_ids[10][3] = R.id.poceDSecnd_PdceRest_10;
//        poceDSecnd_ids[10][4] = R.id.poceDSecnd_UpSheet_10;
//        poceDSecnd_ids[10][5] = R.id.poceDSecnd_Length_10;
//        poceDSecnd_ids[10][6] = R.id.poceDSecnd_Width_10;
//        poceDSecnd_ids[10][7] = R.id.poceDSecnd_DSQ_10;
//        poceDSecnd_ids[10][8] = R.id.poceDSecnd_Times_10;
//        poceDSecnd_ids[10][9] = R.id.poceDSecnd_LabourCost_10;
//        poceDSecnd_ids[10][10] = R.id.poceDSecnd_DSheet_10;
//        poceDSecnd_ids[10][11] = R.id.poceDSecnd_Pcs_10;
//        poceDSecnd_ids[10][12] = R.id.poceDSecnd_AMould_10;
//        poceDSecnd_ids[10][13] = R.id.poceDSecnd_Mould_10;
//        poceDSecnd_ids[10][14] = R.id.poceDSecnd_TotalQty_10;
//        poceDSecnd_ids[10][15] = R.id.poceDSecnd_MinCost_10;
//        poceDSecnd_ids[10][16] = R.id.poceDSecnd_TotalCost_10;
//        poceDSecnd_ids[10][17] = R.id.poceDSecnd_UnitCost_10;
//        poceDSecnd_ids[10][18] = R.id.poceDSecnd_Remake_10;
//        poceDSecnd_ids[10][19] = R.id.poceDSecnd_TypeCode_10;


    }

    private void initBKBIds() {
//        bkb_ids[3][0] = R.id.BKB_Item_3;
//        bkb_ids[3][1] = R.id.BKB_PodueRest_3;
//        bkb_ids[3][2] = R.id.BKB_Numb_3;
//        bkb_ids[3][3] = R.id.BKB_Unit_3;
//        bkb_ids[3][4] = R.id.BKB_HourPrice_3;
//        bkb_ids[3][5] = R.id.BKB_HandSeconds_3;
//        bkb_ids[3][6] = R.id.BKB_HandCFCient_3;
//        bkb_ids[3][7] = R.id.BKB_MinPrice_3;
//        bkb_ids[3][8] = R.id.BKB_MinCost_3;
//        bkb_ids[3][9] = R.id.BKB_TotalCost_3;
//        bkb_ids[3][10] = R.id.BKB_UnitCost_3;
//        bkb_ids[3][11] = R.id.BKB_Remake_3;
//        bkb_ids[3][12] = R.id.BKB_TypeCode_3;
//
//        bkb_ids[4][0] = R.id.BKB_Item_4;
//        bkb_ids[4][1] = R.id.BKB_PodueRest_4;
//        bkb_ids[4][2] = R.id.BKB_Numb_4;
//        bkb_ids[4][3] = R.id.BKB_Unit_4;
//        bkb_ids[4][4] = R.id.BKB_HourPrice_4;
//        bkb_ids[4][5] = R.id.BKB_HandSeconds_4;
//        bkb_ids[4][6] = R.id.BKB_HandCFCient_4;
//        bkb_ids[4][7] = R.id.BKB_MinPrice_4;
//        bkb_ids[4][8] = R.id.BKB_MinCost_4;
//        bkb_ids[4][9] = R.id.BKB_TotalCost_4;
//        bkb_ids[4][10] = R.id.BKB_UnitCost_4;
//        bkb_ids[4][11] = R.id.BKB_Remake_4;
//        bkb_ids[4][12] = R.id.BKB_TypeCode_4;
//
//        bkb_ids[5][0] = R.id.BKB_Item_5;
//        bkb_ids[5][1] = R.id.BKB_PodueRest_5;
//        bkb_ids[5][2] = R.id.BKB_Numb_5;
//        bkb_ids[5][3] = R.id.BKB_Unit_5;
//        bkb_ids[5][4] = R.id.BKB_HourPrice_5;
//        bkb_ids[5][5] = R.id.BKB_HandSeconds_5;
//        bkb_ids[5][6] = R.id.BKB_HandCFCient_5;
//        bkb_ids[5][7] = R.id.BKB_MinPrice_5;
//        bkb_ids[5][8] = R.id.BKB_MinCost_5;
//        bkb_ids[5][9] = R.id.BKB_TotalCost_5;
//        bkb_ids[5][10] = R.id.BKB_UnitCost_5;
//        bkb_ids[5][11] = R.id.BKB_Remake_5;
//        bkb_ids[5][12] = R.id.BKB_TypeCode_5;
//
//        bkb_ids[6][0] = R.id.BKB_Item_6;
//        bkb_ids[6][1] = R.id.BKB_PodueRest_6;
//        bkb_ids[6][2] = R.id.BKB_Numb_6;
//        bkb_ids[6][3] = R.id.BKB_Unit_6;
//        bkb_ids[6][4] = R.id.BKB_HourPrice_6;
//        bkb_ids[6][5] = R.id.BKB_HandSeconds_6;
//        bkb_ids[6][6] = R.id.BKB_HandCFCient_6;
//        bkb_ids[6][7] = R.id.BKB_MinPrice_6;
//        bkb_ids[6][8] = R.id.BKB_MinCost_6;
//        bkb_ids[6][9] = R.id.BKB_TotalCost_6;
//        bkb_ids[6][10] = R.id.BKB_UnitCost_6;
//        bkb_ids[6][11] = R.id.BKB_Remake_6;
//        bkb_ids[6][12] = R.id.BKB_TypeCode_6;
//
//        bkb_ids[7][0] = R.id.BKB_Item_7;
//        bkb_ids[7][1] = R.id.BKB_PodueRest_7;
//        bkb_ids[7][2] = R.id.BKB_Numb_7;
//        bkb_ids[7][3] = R.id.BKB_Unit_7;
//        bkb_ids[7][4] = R.id.BKB_HourPrice_7;
//        bkb_ids[7][5] = R.id.BKB_HandSeconds_7;
//        bkb_ids[7][6] = R.id.BKB_HandCFCient_7;
//        bkb_ids[7][7] = R.id.BKB_MinPrice_7;
//        bkb_ids[7][8] = R.id.BKB_MinCost_7;
//        bkb_ids[7][9] = R.id.BKB_TotalCost_7;
//        bkb_ids[7][10] = R.id.BKB_UnitCost_7;
//        bkb_ids[7][11] = R.id.BKB_Remake_7;
//        bkb_ids[7][12] = R.id.BKB_TypeCode_7;
//
//        bkb_ids[8][0] = R.id.BKB_Item_8;
//        bkb_ids[8][1] = R.id.BKB_PodueRest_8;
//        bkb_ids[8][2] = R.id.BKB_Numb_8;
//        bkb_ids[8][3] = R.id.BKB_Unit_8;
//        bkb_ids[8][4] = R.id.BKB_HourPrice_8;
//        bkb_ids[8][5] = R.id.BKB_HandSeconds_8;
//        bkb_ids[8][6] = R.id.BKB_HandCFCient_8;
//        bkb_ids[8][7] = R.id.BKB_MinPrice_8;
//        bkb_ids[8][8] = R.id.BKB_MinCost_8;
//        bkb_ids[8][9] = R.id.BKB_TotalCost_8;
//        bkb_ids[8][10] = R.id.BKB_UnitCost_8;
//        bkb_ids[8][11] = R.id.BKB_Remake_8;
//        bkb_ids[8][12] = R.id.BKB_TypeCode_8;
//
//        bkb_ids[9][0] = R.id.BKB_Item_9;
//        bkb_ids[9][1] = R.id.BKB_PodueRest_9;
//        bkb_ids[9][2] = R.id.BKB_Numb_9;
//        bkb_ids[9][3] = R.id.BKB_Unit_9;
//        bkb_ids[9][4] = R.id.BKB_HourPrice_9;
//        bkb_ids[9][5] = R.id.BKB_HandSeconds_9;
//        bkb_ids[9][6] = R.id.BKB_HandCFCient_9;
//        bkb_ids[9][7] = R.id.BKB_MinPrice_9;
//        bkb_ids[9][8] = R.id.BKB_MinCost_9;
//        bkb_ids[9][9] = R.id.BKB_TotalCost_9;
//        bkb_ids[9][10] = R.id.BKB_UnitCost_9;
//        bkb_ids[9][11] = R.id.BKB_Remake_9;
//        bkb_ids[9][12] = R.id.BKB_TypeCode_9;
//
//        bkb_ids[10][0] = R.id.BKB_Item_10;
//        bkb_ids[10][1] = R.id.BKB_PodueRest_10;
//        bkb_ids[10][2] = R.id.BKB_Numb_10;
//        bkb_ids[10][3] = R.id.BKB_Unit_10;
//        bkb_ids[10][4] = R.id.BKB_HourPrice_10;
//        bkb_ids[10][5] = R.id.BKB_HandSeconds_10;
//        bkb_ids[10][6] = R.id.BKB_HandCFCient_10;
//        bkb_ids[10][7] = R.id.BKB_MinPrice_10;
//        bkb_ids[10][8] = R.id.BKB_MinCost_10;
//        bkb_ids[10][9] = R.id.BKB_TotalCost_10;
//        bkb_ids[10][10] = R.id.BKB_UnitCost_10;
//        bkb_ids[10][11] = R.id.BKB_Remake_10;
//        bkb_ids[10][12] = R.id.BKB_TypeCode_10;

    }

    private void initFOBIds() {
        fob_ids[0][0] = R.id.FOB_item1_1;
        fob_ids[0][1] = R.id.FOB_item2_1;
        fob_ids[0][2] = R.id.FOB_price_1;
        fob_ids[0][3] = R.id.FOB_TotalQty_1;
        fob_ids[0][4] = R.id.FOB_MinCost_1;
        fob_ids[0][5] = R.id.FOB_TotalCost_1;
        fob_ids[0][6] = R.id.FOB_UnitCost_1;
        fob_ids[0][7] = R.id.FOB_Remake_1;

        fob_ids[1][0] = R.id.FOB_item1_3;
        fob_ids[1][1] = R.id.FOB_item2_3;
        fob_ids[1][2] = R.id.FOB_price_3;
        fob_ids[1][3] = R.id.FOB_TotalQty_3;
        fob_ids[1][4] = R.id.FOB_MinCost_3;
        fob_ids[1][5] = R.id.FOB_TotalCost_3;
        fob_ids[1][6] = R.id.FOB_UnitCost_3;
        fob_ids[1][7] = R.id.FOB_Remake_3;

        fob_ids[2][0] = R.id.FOB_item1_4;
        fob_ids[2][1] = R.id.FOB_item2_4;
        fob_ids[2][2] = R.id.FOB_price_4;
        fob_ids[2][3] = R.id.FOB_TotalQty_4;
        fob_ids[2][4] = R.id.FOB_MinCost_4;
        fob_ids[2][5] = R.id.FOB_TotalCost_4;
        fob_ids[2][6] = R.id.FOB_UnitCost_4;
        fob_ids[2][7] = R.id.FOB_Remake_4;

        fob_ids[3][0] = R.id.FOB_item1_5;
        fob_ids[3][1] = R.id.FOB_item2_5;
        fob_ids[3][2] = R.id.FOB_price_5;
        fob_ids[3][3] = R.id.FOB_TotalQty_5;
        fob_ids[3][4] = R.id.FOB_MinCost_5;
        fob_ids[3][5] = R.id.FOB_TotalCost_5;
        fob_ids[3][6] = R.id.FOB_UnitCost_5;
        fob_ids[3][7] = R.id.FOB_Remake_5;

        fob_ids[4][0] = R.id.FOB_item1_6;
        fob_ids[4][1] = R.id.FOB_item2_6;
        fob_ids[4][2] = R.id.FOB_price_6;
        fob_ids[4][3] = R.id.FOB_TotalQty_6;
        fob_ids[4][4] = R.id.FOB_MinCost_6;
        fob_ids[4][5] = R.id.FOB_TotalCost_6;
        fob_ids[4][6] = R.id.FOB_UnitCost_6;
        fob_ids[4][7] = R.id.FOB_Remake_6;

        fob_ids[5][0] = R.id.FOB_item1_7;
        fob_ids[5][1] = R.id.FOB_item2_7;
        fob_ids[5][2] = R.id.FOB_price_7;
        fob_ids[5][3] = R.id.FOB_TotalQty_7;
        fob_ids[5][4] = R.id.FOB_MinCost_7;
        fob_ids[5][5] = R.id.FOB_TotalCost_7;
        fob_ids[5][6] = R.id.FOB_UnitCost_7;
        fob_ids[5][7] = R.id.FOB_Remake_7;

        fob_ids[6][0] = R.id.FOB_item1_8;
        fob_ids[6][1] = R.id.FOB_item2_8;
        fob_ids[6][2] = R.id.FOB_price_8;
        fob_ids[6][3] = R.id.FOB_TotalQty_8;
        fob_ids[6][4] = R.id.FOB_MinCost_8;
        fob_ids[6][5] = R.id.FOB_TotalCost_8;
        fob_ids[6][6] = R.id.FOB_UnitCost_8;
        fob_ids[6][7] = R.id.FOB_Remake_8;

        fob_ids[7][0] = R.id.FOB_item1_9;
        fob_ids[7][1] = R.id.FOB_item2_9;
        fob_ids[7][2] = R.id.FOB_price_9;
        fob_ids[7][3] = R.id.FOB_TotalQty_9;
        fob_ids[7][4] = R.id.FOB_MinCost_9;
        fob_ids[7][5] = R.id.FOB_TotalCost_9;
        fob_ids[7][6] = R.id.FOB_UnitCost_9;
        fob_ids[7][7] = R.id.FOB_Remake_9;
    }

    private void initGIFIds() {
        gif_ids[0][0] = R.id.GIF_Item;
        gif_ids[0][1] = R.id.GIF_Price;
        gif_ids[0][2] = R.id.GIF_TotalQty;
        gif_ids[0][3] = R.id.GIF_MinCost;
        gif_ids[0][4] = R.id.GIF_Toalcost;
        gif_ids[0][5] = R.id.GIF_UnitCost;
        gif_ids[0][6] = R.id.GIF_Remake;

        gif_ids[1][0] = R.id.GIF_Item1;
        gif_ids[1][1] = R.id.GIF_Price1;
        gif_ids[1][2] = R.id.GIF_TotalQty1;
        gif_ids[1][3] = R.id.GIF_MinCost1;
        gif_ids[1][4] = R.id.GIF_Toalcost1;
        gif_ids[1][5] = R.id.GIF_UnitCost1;
        gif_ids[1][6] = R.id.GIF_Remake1;

        gif_ids[2][0] = R.id.GIF_Item2;
        gif_ids[2][1] = R.id.GIF_Price2;
        gif_ids[2][2] = R.id.GIF_TotalQty2;
        gif_ids[2][3] = R.id.GIF_MinCost2;
        gif_ids[2][4] = R.id.GIF_Toalcost2;
        gif_ids[2][5] = R.id.GIF_UnitCost2;
        gif_ids[2][6] = R.id.GIF_Remake2;


    }

    private void initDOCIds() {
        doc_ids[0][0] = R.id.DOC_Item;
        doc_ids[0][1] = R.id.DOC_Price;
        doc_ids[0][2] = R.id.DOC_TotalQty;
        doc_ids[0][3] = R.id.DOC_MinCost;
        doc_ids[0][4] = R.id.DOC_TotalCost;
        doc_ids[0][5] = R.id.DOC_UnitCost;
        doc_ids[0][6] = R.id.DOC_Remake;

        doc_ids[1][0] = R.id.DOC_Item1;
        doc_ids[1][1] = R.id.DOC_Price1;
        doc_ids[1][2] = R.id.DOC_TotalQty1;
        doc_ids[1][3] = R.id.DOC_MinCost1;
        doc_ids[1][4] = R.id.DOC_TotalCost1;
        doc_ids[1][5] = R.id.DOC_UnitCost1;
        doc_ids[1][6] = R.id.DOC_Remake1;

        doc_ids[2][0] = R.id.DOC_Item2;
        doc_ids[2][1] = R.id.DOC_Price2;
        doc_ids[2][2] = R.id.DOC_TotalQty2;
        doc_ids[2][3] = R.id.DOC_MinCost2;
        doc_ids[2][4] = R.id.DOC_TotalCost2;
        doc_ids[2][5] = R.id.DOC_UnitCost2;
        doc_ids[2][6] = R.id.DOC_Remake2;

        doc_ids[3][0] = R.id.DOC_Item3;
        doc_ids[3][1] = R.id.DOC_Price3;
        doc_ids[3][2] = R.id.DOC_TotalQty3;
        doc_ids[3][3] = R.id.DOC_MinCost3;
        doc_ids[3][4] = R.id.DOC_TotalCost3;
        doc_ids[3][5] = R.id.DOC_UnitCost3;
        doc_ids[3][6] = R.id.DOC_Remake3;
    }

    public void selectCalendar(final TextView v) {
        Calendar calendar = Calendar.getInstance();
        DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), new DatePickerDialog.OnDateSetListener() {
            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                v.setText(year + "-" + (monthOfYear + 1) + "-" + dayOfMonth);
            }
        }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
        datePickerDialog.show();
    }

    @Override
    public void onRefresh() {

    }

    @Override
    public void getPrintMesg(PrintMesg printMesg) {
        ArrayList<String> printCustomerList = new ArrayList<>();
        List<PrintMesg.DataBeanX.DataBean> data = printMesg.getData().getData();
        for (PrintMesg.DataBeanX.DataBean dataBean : data) {
            printCustomerList.add(dataBean.getName());
        }
        //厂商编号
        ArrayAdapter<String> printCustomerAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, printCustomerList);
        printCustomerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        BagSpCustom.setAdapter(printCustomerAdapter);
    }

    @Override
    public void getPrintMesgError(String error) {
        ToastUtil.showToast(getContext(), error);
    }

    @Override
    public void getPaperTypeName(PaperTypeName paperTypeName) {
        ArrayList<String> paperTypeNameList = new ArrayList<>();
        List<PaperTypeName.DataBeanX.DataBean> data = paperTypeName.getData().getData();
        for (PaperTypeName.DataBeanX.DataBean dataBean : data) {
            paperTypeNameList.add(dataBean.getTypename());
        }
        paperTypeNameAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, paperTypeNameList);
        paperTypeNameAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        PaperTypeName1.setAdapter(paperTypeNameAdapter);
        selectedItem = PaperTypeName1.getSelectedItem().toString();
        S9 = PaperTypeName1.getSelectedItem().toString();
    }

    @Override
    public void getPaperTypeNameError(String error) {
        ToastUtil.showToast(getContext(), error);
    }

    @Override
    public void getProcessDonePruRest(ProcessDonePduReust processDonePduReust) {
        ArrayList<String> poceDonePduReustList = new ArrayList<>();
        poceDPdunRest = processDonePduReust.getData().getData();
        for (ProcessDonePduReust.DataBeanX.DataBean dataBean : poceDPdunRest) {
            poceDonePduReustList.add(dataBean.getOtherInfo());
        }
        poceDonePduReustAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, poceDonePduReustList);
        poceDonePduReustAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        processDoneProduceRequest.setAdapter(poceDonePduReustAdapter);
        poceDSecndPdceRest.setAdapter(poceDonePduReustAdapter);
        BKBPodueRest.setAdapter(poceDonePduReustAdapter);
    }

    @Override
    public void getProcessDonePruRestError(String error) {
        ToastUtil.showToast(getContext(), error);
    }

    @Override
    public void getProcessDoneType(ProcessDoneType processDoneType1) {
        ArrayList<String> poceDoneTypeList = new ArrayList<>();
        poceDoneTypeData = processDoneType1.getData().getData();
        for (ProcessDoneType.DataBeanX.DataBean dataBean : poceDoneTypeData) {
            poceDoneTypeList.add(dataBean.getName());
        }
        poceDoneTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, poceDoneTypeList);
        poceDoneTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        processDoneType.setAdapter(poceDoneTypeAdapter);
        poceDSecndType.setAdapter(poceDoneTypeAdapter);
        BKBItem.setAdapter(poceDoneTypeAdapter);
    }

    @Override
    public void getProcessDoneTypeError(String error) {
        ToastUtil.showToast(getContext(), error);
    }

    @Override
    public void getExchangeRate(ExchangeRate exchangeRate) {
        ArrayList<String> exchangeRateList = new ArrayList<>();
        exchangeRateData = exchangeRate.getData().getData();
        for (ExchangeRate.DataBeanX.DataBean dataBean : exchangeRateData) {
            exchangeRateList.add(dataBean.getCname());
        }
        moneyTypeAdapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_dropdown_item, exchangeRateList);
        moneyTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        PaperMoneyType1.setAdapter(moneyTypeAdapter);
    }

    @Override
    public void getExchangeRateError(String error) {
        ToastUtil.showToast(getContext(), error);
    }

    @Override
    public void getDGsm(PaperDGsm paperDGsm) {

    }

    @Override
    public void getDGsmError(String error) {
        ToastUtil.showToast(getContext(), error);
    }


    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
        itemGrpNameList.clear();
        k = 0;
    }
}
